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
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- 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...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: