everything works except for inserting into a db. This is where it gets wierd.
I am getting a SYNTAX error for the following...
$from = $_SESSION[Username];
$to = $_POST[touser];
$mess = $_POST[message];
$seen = 'no';
$date = date("m.d.y");
$fname = $filename;
$doquery = mysql_query("INSERT INTO files (From, To, Date, Fname, Message, Seen) VALUES('".$from."', '".$to."', '".$date."', '".$fname."', '".$mess."', '".$seen."')")or die ('Error: ' . mysql_error());;
if($doquery)
{
echo "<h2>Success</h2>";
}
else
{
echo "<h2>Error</h2>";
}
so, this gives me this error.
Quote
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 'From, To, Date, Fname, Message, Seen,) VALUES('aych', 'karl', '11.04.09', 'img1.gif'' at line 1
now.. all i have done is copied this from a working version (below) and changed a couple small variables and stuff... so what is wrong with it?
The working version
$regquery = mysql_query("INSERT INTO users (Username, Password, EmailAddress, FirstName, LastName, Address, State, Zip) VALUES('".$username."', '".$password."', '".$email."', '".$firstname."', '".$lastname."', '".$address."', '".$state."', '".$zip."')")or die ('I cannot connect to the database because: ' . mysql_error());;
if($regquery)
{
echo '<h2>Success</h2>';
echo '<p>User account for '.$firstname . $lastname .' has been made.</p>';
}
else
{
echo '<h2>Error</h2>';
echo '<p>Could not register the account please try again</p>';
echo register_form();
}
if the full script is needed i can provide that aswell
Edited by er0x, 04 November 2009 - 02:55 PM.
