Hi, I really need some help with this, Ive been trying to figure it out for such a long time!
Ok, I want this to connect to the database, and then insert info into the table, which I already have created. Here is the exact script:
<?php
$username = $_COOKIE['ID_my_site'];
$msg = $_POST['message'];
$to = $_POST['to'];
mysql_connect("freshsql.com","username","password")or die("SQL Error".mysql_error());;
mysql_select_db("data1")or die("SQL Error".mysql_error());;
$query="INSERT INTO messages(username,from,message) VALUES('$to',$username','$msg')";
mysql_query($query)or die("SQL Error".mysql_error());
?>
It keeps returning an error:
"SQL ErrorYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''messages'(username,from,message) VALUES('gs',gs','gsaafd')' at line 1"
Please help! I cannot figure this out, Thanks
-GS
EDIT:
Use meaningful topic subject names and post in the correct forum.