There isn't anything in Company Code at the moment, it's a blank field, isn't that just going to put 0000 in all fields
_____ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of HardyBoyz Sent: Wednesday, March 05, 2008 12:23 AM To: [email protected] Subject: Re: [php_mysql] Auto Inserts a Company Code i think it's just using looping..like for and while. //Define the connection to database here //doing query table $query="SELECT * FROM table_name"; $ex=mysql_query($query); //get the max of records $total_rec=mysql_num_rows($ex); //looping for getting oldvalues while($oldvalue=mysql_fetch_array($ex)) { for ($i=0;$i<=$total_rec - 1;$i++) { //looping for change oldvalue. $query="UPDATE table_name SET Company_code='0000'.$oldvalue[1] WHERE id_company=$i"; } } The listing code above is in my logic...i'm never test it before. Brian Boothe <[EMAIL PROTECTED] <mailto:bboothe%40mcsmicro.net> net> wrote: I have a mysql database table setup already but I need to go back and enter in a 4 digit Company Code to each of my records how can I do this automatically that starts at the First record with 0000 And automatically Increments and inserts into each of the rest of the records: ,, thanks for all your help <http://geo.yahoo. <http://geo.yahoo.com/serv?s=97359714/grpId=1299023/grpspId=1705375618/msgId > com/serv?s=97359714/grpId=1299023/grpspId=1705375618/msgId =6574/stime=1204578826/nc1=3848585/nc2=4763762/nc3=5170408> [Non-text portions of this message have been removed] --------------------------------- Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. [Non-text portions of this message have been removed] [Non-text portions of this message have been removed]
