Hey John, Thanks for the reply, Am a bit confused, 2 guys already gave me the advise you are giving me but you also say "CHANGE COLUMN old_column_name new_column_name" why to change the column name? dont I only have to change it from being an "int" to an "Auto_Increment"?
Kindly reply, Cheers, -Ryan. > ALTER TABLE your_table CHANGE COLUMN old_column_name new_column_name NOT > NULL AUTO_INCREMENT PRIMARY KEY; > > Then use mysql_insert_id() in your PHP code to retrieve the ID that is > generated upon INSERTs. > > ---John Holmes... > > > -----Original Message----- > > From: Ryan A [mailto:[EMAIL PROTECTED]] > > Sent: Saturday, September 28, 2002 12:17 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP] Challenging problem for you programing gurus... > > > > Hi guys, > > I have come accross a small problem while trying to convert a java > program > > to a PHP one.... > > my database table is like so > > > > ************* > > cno (int) > > name (varchar) > > lastname(varchar) > > etc etc > > ************* > > > > as you can see the details I take is name/lastname and customer number > > (cno) is automatically generated, now instead of using a "auto > increment" > > a "int" was declared and this code was used > > > > ************************** > > synchronized(this) > > { > > rs=stmt.executeQuery("select max(cno)+1 from cust"); > > } > > ************************** > > > > (for those of you who dont understand java) > > the "synchronized" keyword makes sure only one thread can work in the > > "block" of code between the "{" and "}" then it executes the query > "select > > max(cno)+1 from cust" and stores the result in an array (like PHP) in > > "rs". > > > > Basically, it just gets the next higher cno from the table cust. > > > > Then it enters the cno like this rs=cno,then name,lastname etc and > then > > tells the customer that the data has been entered and his new customer > > number is <rs>. > > > > > > As you can see its a pain in the ass job which has to be changed, > > the problem is a few hundred records have already been entered, > > how do i use the current table BUT use the more useful auto increment > and > > LAST_INSERT_ID() via PHP? > > The java servlet program which is handleing the requests is working > fine, > > but I am want to convert it to a PHP program as paying for servlet > hosting > > is upto 5-8 times more...and I aint rich, or even close to being rich > :-( > > > > > > Please reply, > > ANY help appreciated and thanks in advance. > > Cheers, > > -Ryan. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php