law Posted July 22, 2008 Share Posted July 22, 2008 I'm updating a field that is varchar. As a test I'm passing the string "Updated Title." Here is my error: Truncated incorrect DOUBLE value: 'Title Updated' Here is my code //-==========Variables========================- $var0 = $_POST['creator']; $var1 = $_POST['date']; $var2 = $_POST['table']; $var3 = $_POST['id']; $var4 = $_POST['body']; $var5 = $_POST['title']; //-==========================================- if ($var3 !== 0){ $result = mysql_query("UPDATE $var2 SET title = '$var5' AND body = '$var4' AND creator = '$var0' AND date = '$var1' WHERE id = '$var3'")or die(mysql_error()); echo "update successful"; }else { $result = mysql_query("INSERT INTO $var2(title, body, creator, date) VALUES('$var5', '$var4', '$var0', '$var1')"); echo "<br/> insert successful"; My guess is this is some sort of syntax error. I am self taught which = I know nothing about correct syntax or structure. (or much of anything :-X) Quote Link to comment Share on other sites More sharing options...
Xurion Posted July 22, 2008 Share Posted July 22, 2008 In your update you need to use commas instead of AND: SET column='value', column='value' That error looks like you're trying to update a double data type column. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.