Hey all this script is driving me nuts I just cant see why it doesnt insert new rows, each iteration of the loop it prints output to the screen before inserting a new record but no dice on the record insert =( Any ideas? THANKS
heres the code
<?php
mysql_connect("localhost", "root", "");
mysql_select_db("vantage-conversions");
$query = "SELECT * FROM parts";
$result = mysql_query($query);
while ($row = mysql_fetch_array ($result))
{
//================
// Read and convert string
//================
$string_lower = strtolower($row[desc]);
$done = ucfirst($string_lower);
$done = ereg_replace("[@:=\/';,-.!<>%&()_A-Za-z0-9 ]", "", $done);
$id = $row[partid];
print "<table border=1><td>$row[partid]</td><td>$id</td><td>$row[desc]</td><td>$done</td></table>";
//================
// Insert converted data into new table
//================
mysql_connect("localhost", "root", "");
mysql_select_db("vantage-conversions");
$query2 = "INSERT INTO parts2 (partid, desc) VALUES ('$row[partid]', '$done')";
$result2 = mysql_query($query2);
}
?>