View Single Post
  #1 (permalink)  
Old April 28th, 2004, 09:49 AM
Alex_forever Alex_forever is offline
Authorized User
 
Join Date: Apr 2004
Location: , , .
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to do a mysql update using varibles in a query

every time I use this:

$query = "UPDATE AddTable2 SET Code='$c', Description='$d', Name='$n' WHERE Id=$id";
$result = @mysql_query($query) or die (mysql_error());
//new screen
if ($result)// it ran
{
    echo '<p>You have updated your information</p>';
    include ('WSfooter.inc'); // Include the HTML footer.
    exit(); // Quit the script.
}
else
{
    $message = '<p>Something is wrong</p><p>'. mysql_error() . '</p>';
}

mysql_close(); // Close the database connection.
}

I get this:
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 '' at line 1

Someone please help

Reply With Quote