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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Calimero
Forum Contributor
Posts: 310
Joined: Thu Jan 22, 2004 6:54 pm
Location: Milky Way

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

Post 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.
Last edited by Calimero on Wed Jun 09, 2004 1:12 am, edited 1 time in total.
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post 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
User avatar
Calimero
Forum Contributor
Posts: 310
Joined: Thu Jan 22, 2004 6:54 pm
Location: Milky Way

THANKS

Post by Calimero »

This is so simple ?!?!?!?!?!?!?!?
I just cant believe this,
Realy THANKS !!!
:D :D :D
Post Reply