Home arrow PHP arrow Generating Contract Numbers for Online Licenses using PHP and MySQL

Generating Contract Numbers for Online Licenses using PHP and MySQL

PHP and MySQL form a powerful combination of open source technology available to any web developer. One of the increasing trends in modern web development is the generation of online contracts. E-commerce websites selling services online need automated contract generation for faster delivery of services. This article will help you learn to use this technology so you can get it working on your web site.

TABLE OF CONTENTS:
  1. Generating Contract Numbers for Online Licenses using PHP and MySQL
  2. Inserting generated random numbers into a MySQL database
  3. Basic Form Code
  4. Generate Unique Contract numbers
By: Codex-M
Rating: starstarstarstarstar / 8
April 28, 2009

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

One of the most common applications is issuing licenses online. In the real world, licenses are issued on paper and signed by both parties. In the online world, this can be done efficiently with an online contract which can be traced by issuing a contract number. Contract numbers are the best way to track those licenses; with every licensing agreement, there should an accompanying licensing contract.

Simple PHP Contract Generation Script

To understand how to generate contract numbers, let’s consider a basic example:

<?php

echo mt_rand(min, max);

echo '<br />';

?>

This piece of random code will generate random number between min and max. So for example, if you need to generate a random number between 10000 and 15000, the code would look like this:

<?php

echo mt_rand(10000, 15000);

echo '<br />';

?>

Bear in mind that 10,000 is the minimum random number that will be generated and 15,000 is the maximum random number that will be generated.

There are a countless number of applications for a PHP random number generator script; these may include games, random number quizzes, number-based passwords, etc.

If you've learned PHP before, you must have met the PHP random number function rand(). This is the classic random number function. In the simple random number generator script above, we are using:

mt_rand();

The only difference between mt_rand() and rand() is speed. The mt_rand() function is capable of processing four times faster than the old random generator script.



 
 
>>> More PHP Articles          >>> More By Codex-M
 

blog comments powered by Disqus
   

PHP ARTICLES

- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...
- PHP: Building Concrete Validators
- Sanitizing Input with PHP
- Executing Shell Commands with PHP
- Handling File Data with PHP
- File Security and Resources with PHP
- ArrayObject PHP Class Examples
- ArrayObject PHP Class: An Introduction
- Getting File System Data with PHP
- PHP Tools for Working with the File and Oper...
- Working with the File and Operating System w...
- PHP Proxy Patterns: Completing a Blog


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 4 - Follow our Sitemap

Dev Shed Tutorial Topics: