Page 1 of 1

[SOLVED]create array of letters & numbers to use in DB c

Posted: Tue Jun 08, 2004 1:46 am
by Calimero
DONT MOVE THIS :), I think its realy more to PHP than MySQL

Ok this is the problem,
When I insert certain record in the table/DB (MySQL) autoincrement does the job (my ID column).
But what I want is that not only numbers are inserted in this column but letters.
The only way I see it possible is to declare an array in PHP that contains
all numbers and all small and big letters 0-9 AND a-z AND A-Z
When the form is submitted there will be no autoincrement in the database, because the PHP would generate the first next value and insert it in the prescribed column.

Example (the way I see it):
last record in the table is a34VCa
the next one should be a34VCb

So - how can PHP be told to read the value from the DB, understand this array in this way and to insert "increased" value (by one) in the table.

Can array be inside the script, or called from somewhere elese ??

I dont know HOW to code this, so please the code if possible.
Thanks ahead.

Posted: Tue Jun 08, 2004 1:55 am
by markl999
No idea about all your auto increment stuff or why you want it, so i won't go into that ;). But on the PHP side you can simply do something like:

Code: Select all

$a = 'a34VCa';
$next = ++$a;
//$next will now be a34VCb

THANKS

Posted: Wed Jun 09, 2004 1:07 am
by Calimero
This is so simple ?!?!?!?!?!?!?!?
I just cant believe this,
Realy THANKS !!!
:D :D :D