I need to copy a primary key from one table and post the results into another table. I was almost successful but I got this 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 'long, postal_code)VALUES ('Resource id #5', '12.1231', '122.1231', 'V7S1B7')' at line 1
Is there anyway I can trim off the "resource id #" part and get the 5 and put it in the other table? :queasy:
Here's the coding I used.
$presql = "SELECT city_id FROM city WHERE city = '" . $_POST['cubcat3'] . "'";
$preresult = mysql_query($presql)
or die(mysql_error());
$sql = "INSERT INTO postal (city_id, lat, long, postal_code)" .
"VALUES ('$preresult', '" . $_POST['username'] . "', '" . $_POST['email'] . "', '" . $_POST['address'] . "');";
$result = mysql_query($sql)
or die(mysql_error());
Thanks for the help 😃