Advertisement

08.07.2007 at 03:51AM PDT, ID: 22746197
[x]
Attachment Details

how to generate customized ID automatically using php/mysql?

Asked by AymanAdam in PHP Scripting Language

Tags: generate, php, id, number, mysql

hi experts!,

simply my problem is that i want to generate some id (ProjectID) automatically (user haven't to worry about entering this field), but my issue is that this id must be intelligent in other words it is not just auto incremented field. it consists of two parts (text and serial number of specific number of digits). to make it much clear lets consider this scenario:
i have a text field in my form that is filled by user, this is the field which i use to generate the ProjectID
if for example the user entered in this field the value ("test") and this was the first entery in my list of prjects then the ProjectID must be ("test00000001").
furthermore the number of digits (of the numeric part) is exactly 8 digits. i know that for the first part of the generated id it is straightforward just get user value and put it in. the problem is in the rest .
examples of generated ids:

ProjectID:
*************
iddr00000002                     -> corresponds to project number 2   -> user entered  (iddr)
amcu00000100                   -> corresponds to project number 100        -> user entered (amcu)
someText00020003            -> corresponds to project number 20003             -> user entered (someText)

i think it is clear now. one thing is that the number part must be 8 digits length, left padded with zeros as above examples exaclty.

i am using php5 with mysql 5 also and apache 1.3 (just FYI).
thanks to all participants in advance.
for more info please ask.Start Free Trial
 
 
[+][-]08.07.2007 at 04:10AM PDT, ID: 19644618

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.07.2007 at 04:11AM PDT, ID: 19644624

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.07.2007 at 04:48AM PDT, ID: 19644783

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.07.2007 at 05:49AM PDT, ID: 19645170

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: PHP Scripting Language
Tags: generate, php, id, number, mysql
Sign Up Now!
Solution Provided By: ahoffmann
Participating Experts: 1
Solution Grade: B
 
 
[+][-]08.08.2007 at 12:33AM PDT, ID: 19652106

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628