Inserting Processed Data from One Table 2 Another!

From: Date: Wed, 24 Jul 2002 07:01:51 +0000
Subject: Inserting Processed Data from One Table 2 Another!
Groups: php.general 
Request: Send a blank email to php-general+get-109267@lists.php.net to get a copy of this message
Ok i have simple issue, i'm stuck at one point. I have a table "Clientdetails" which contains ClientID. I have created another table "Authentication" with 2 fields, "ClientID" and "Password". I want to pick up the ClientID from table "Clientdetails" and insert "ClientID" and a Password i have generated using a code, into "Authentication". So if there are 13000 ClientID's in "Clientdetails", as, many rows with the ClientID & it's corresponding password should be Inserted into table "Authentication". I'm using the following code which i know is wrong, what would be correct? <? $db = mysql_connect("localhost","user","pwd"); mysql_select_db("myDB",$db); $result = mysql_query("SELECT * FROM clientdetails",$db); if ($myrow = mysql_fetch_array($result)) { do { $some = $myrow[clientid] $newid = eregi_replace('100', '', $myrow[clientid]); $date = date("dn"); $stuff = $newid.def.$date; $sql = "INSERT INTO authentication VALUES('$some','$stuff')"; $result = mysql_query($sql); echo "All Done!"; } while ($myrow = mysql_fetch_array($result)); } ?> Thanks, T. Edison Jr. __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com

« previous php.general (#109267) next »