Problems with UPDATE
Hello
I'm having problems with using the UPDATE command. When I try to use it I get a SQL error message:
"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 '280=8.00-22.00 WHERE id = '1' LIMIT 1' at line 1"
I've tried to find an error that can solve the problem but haven't found one, but hopefully you can help instead. The PHP version of my webhotel is 4.3.10
and the MySQL version is 4.0.24-standard.
The thing is that I have time booking table where you should be able to change the existing values for your own entry, www.thomas.anden.name/tidbokning.php
The code:
$link = @mysql_connect("localhost","and1184_arvid","fjang") or die ("I can't connect to database because: " . mysql_error());
$db = @mysql_select_db("and1184_amcb") or die(mysql_error());
if ($_POST[loggedin] == "280" && $_POST[uppdatera] != "")
{
$info_to_update = mysql_real_escape_string($_POST[1]);
$query = "UPDATE tidbokning SET " .$_POST[uppdatera]. "=" .$info_to_update. " WHERE id = '1' LIMIT 1;";
$result = @mysql_query($query) or die(mysql_error());
if ($result) { echo "Dina uppgifter uppdaterades!<br>"; }
}
I've tried a hole bunch of other solutions and the only one that works is if I use the SQL-query:
$query= 'UPDATE `tidbokning` SET 280="8.00-16.00" WHERE `id` = 1 LIMIT 1';
but in this case you can´t use any variables and then of course the hole idea of adding info through a form fails...
/Thomas Andén
Subject
Written By
Posted
Problems with UPDATE
June 10, 2005 03:35AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.