Hi guy's,
I am missing something, what on earth is wrong with this script, I can not get it to insert all my values into a table.
$host="localhost"; // Host name
$username="root"; // Mysql username
$password="1234"; // Mysql password
$db_name="database"; // Database name
$tbl_name="input table"; // Table name
$que = mysql_connect("$host", "$username", "$password");
mysql_select_db("$db_name");
$query = "SELECT value FROM $tbl_name";
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result))
{
$value = row['value']
//CODE TO GET VALUES
//CODE TO GET VALUES
$con = mysql_connect("localhost","root","1234");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database", $con);
$sql="INSERT INTO finaltable (value0, value1, value2)
VALUES
('$value0','value1','$value2')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
mysql_close($con);
}
mysql_close($que)
The code above should get a value from a table, give it to a script in the "while" loop and store it in a final table, When the script is executed i get the error :
"Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'blah blah blah' at line 3"