Big thank you to David Reynolds and MJ Ray for their help.
I've got the script working. It was the insert syntax that I had wrong.
I also need to add slashes before each field is inserted and the only way I could do it with my limited PHP/MySQL knowledge is by adding slashes to each field:
$title = addslashes($result[title]); $description = addslashes($result[description]); $contact = addslashes($result[contact]); $url = addslashes($result[url]); $email = addslashes($result[email]);
mysql_query("INSERT INTO $table2 (title,description,contact,url,email) VALUES('$title','$description','$contact','$url','$email')"); }
I'm sure there is an easier way to do it but it works!
Just need to tidy the syntax up a bit and be more specific about which resource is connected to.
It's kept me out of trouble for the past three days :-)
"Tony" tony@ttiger.co.uk wrote:
$title = addslashes($result[title]);
[...]
I'm sure there is an easier way to do it but it works!
If you're restricted to base PHP, I'm not sure there is, but even then http://uk.php.net/manual/en/function.mysql-real-escape-string.php would be better than addslashes.
Hope that helps,