WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Creates an ID that is some what sequential but still is "a little" difficult to guess, but also is descriptive to the system.
Categories : PHP, MySQL Click here to Update Your Picture
Michael Stearne
Date : Dec 27th 1999
Grade : 5 of 5 (graded 1 times)
Viewed : 3543
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Michael Stearne
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

Creates an ID that is some what sequential but still is "a little" difficult to guess, but also is
descriptive to the system.
-------------------------------------------------------------------
function genID($prefix="",$type="",$table){
global $CS_DATABASE; // Remember to define this outside the function
//// Generated an ID for various uses

srand((double)microtime()*1000000);
$ID=strtoupper($prefix).$type.date("U").sprintf("%03d",rand(0,999));
$testID=mysql_db_query($CS_DATABASE,"select ID from $table where ID='$ID'");

while(@mysql_num_Rows($testID)>0){
//print "DUPLICATE ID $ID <BR>";
$ID=strtoupper($prefix).$type.date("U").sprintf("%03d",rand(0,999));
mysql_free_result($testID);
$testID=mysql_db_query($CS_DATABASE,"select ID from $table where ID='$ID'");
}
mysql_free_result($testID);
return $ID;
}
-------------------------------------------------------------------
Usage:
$InvoiceID=genID("ABC","I","invoice");

ID is like ABCI946349503743 and can create about 50 IDs/sec before running into duplicates.



bookmarker - PHP, PHPLIB, MySQL WWW based bookmark manager
Categories : MySQL, PHP, MySQL, Complete Programs, Databases
Convert MYSQL timestamp (14) fields back to UNIX epoch (seconds) format for display with the date() function. "revertTimeStamp($timestamp)"
Categories : PHP, Date Time, MySQL
Output database records in multiple table columns. multiple, table, columns, output, format, query output, html table, php
Categories : General SQL, Algorithms, PHP, MySQL
MyOrgBook - Online Organizer written in PHP & MySql. Includes online contacts, todo, calendar, update, delete, insert, multi-user interface.
Categories : PHP, MySQL, Calendar, PDAs and Organizers, Databases
Simple usersOnline class - keep track of how many users are online on your site
Categories : PHP, PHP Classes, Databases, MySQL
Function to check connection to MySQL and redirect to an error page if an error occurs
Categories : MySQL, PHP, Debugging, Databases
MySQL Web Interface
Categories : MySQL, Databases, PHP
A PHP useradmin for MySQL. Uploading is easy. The only thing you need is PHP and MySQL installed!
Categories : MySQL, Databases, PHP, HTML and PHP
PostGreSQL and MySQL 2 in 1 db Manager
Categories : PHP, PHP Classes, Databases, PostgreSQL, MySQL
AJAX Data Grid System using php and mysql. A complete login system with the ability to display data in a grid using ajax. Add , update and delete the records without reloading the page.
Categories : PHP, AJAX, Databases, MySQL, Java Script
PHP mySQL learning example This is a complete program to modify tables in a mySQL database on a nice and neat way.
Categories : PHP, MySQL, Complete Programs, HTML and PHP
Loading Images to/from MySQL
Categories : Databases, MySQL, PHP, Graphics
Add Boolean Logic Functions to Database Queries Easily. A function to write a WHERE clause dynamically to search a database from a search form.
Categories : MySQL, PHP, Search
Solution to those 'tell-a-friend' type email issues
Categories : PHP, Email, Databases, MySQL
PHP Object Example of the Perl DBI with MySQL
Categories : PHP, PHP Classes, MySQL, Databases, Perl
 Ahamed Kaize wrote :667
I have a mysql filel with customer and intem information, based on this I want to develope a php script to create webbased invoices.

Who can help me?

Thanks