PHP
  Home arrow PHP arrow Page 2 - Generating Contract Numbers for Online Licenses using PHP and MySQL
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PHP

Generating Contract Numbers for Online Licenses using PHP and MySQL
By: Codex-M
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 7
    2009-04-28


    Table of Contents:
  • Generating Contract Numbers for Online Licenses using PHP and MySQL
  • Inserting generated random numbers into a MySQL database
  • Basic Form Code
  • Generate Unique Contract numbers

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Generating Contract Numbers for Online Licenses using PHP and MySQL - Inserting generated random numbers into a MySQL database
    ( Page 2 of 4 )

    Let’s go deeper and make an attempt to put the generated numbers into the MySQL database. To apply this to a realistic application, let’s write a PHP program that will allow us to enter names in the web form, and then have PHP assign a random number from 1 to 10 associated with that name, and then store the data in the MySQL database. In order to make this happen, we will create a database before we build the PHP script. To create a database using phpmyadmin, take the following steps:

    Step 1: Log into phpmyadmin.

    Step 2: Click the “database” link.

    Step 3: In the create new database area, type: “randomnumber” (this is just an example; in your actual application you can select any name you like).

    Step 4: Leave it set to “collation.”

    Step 5: Now that we have a database named “randomnumber,” we will create a table. In the “Create new table on database randomnumber” area, let's type “randgenerated” (again, you can select any names you like).

    Step 6: In the number of fields, type “2.” This is 2 because we will store two types of data; the first column will be the name and the second column will be the random number generated.

    Step 6: In this stage, phpmyadmin will ask you to enter your desired field name and data types.

    For illustration purposes we will use the field “name” and “random,” and then, using the default type varchar, we will use 30 characters for the name and two characters for the associated random number stored.

    Leave everything else as it is, and then click save. MySQL will make a table using your defined variables. You can see the screen shot below; your table should be set up to look like that:

     



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

       

    PHP ARTICLES

    - Adding Ordering and Grouping Clauses to the ...
    - Implementing Factory Methods in PHP 5
    - Merging a File Split for FTP Upload using PHP
    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek