View Single Post
Old 03-09-2008, 05:18 PM   #3 (permalink)
maZtah
The Acquainted
 
Join Date: Oct 2007
Posts: 170
Thanks: 18
maZtah is an unknown quantity at this point
Default

I agree with freenity if the letters don't change.

Else i would do something like:

PHP Code:
// first select the last id
$szQuery 'SELECT id FROM table ORDER BY id DESC LIMIT 1';
$pResult mysql_query($szQuery);

// fetch the result
$aRow mysql_fetch_array($pResult);

// get the integer and the letters (there are much better ways to do this, but can't come up with one right now;()
$iId substr($aRow['id'],0,strlen($aRow['id'])-2);
$szLetters substr($aRow['id'],-2)

// add 1 to the integer
$iId += 1;

// add the letters again
$szId $iId $szLetters;

// and finally, insert the new id
$szQuery 'INSERT INTO table (id) VALUES ("'.$szId.'");
mysql_query($szQuery); 
Well, just typed in this textarea, haven't tested it, but you should figure any bugs out!

Good luck!
maZtah is offline  
Reply With Quote