dumpty Posted August 26, 2007 Share Posted August 26, 2007 Hey $query = "UPDATE table SET $this = $that WHERE id = $id"; $exe = mysql_query($query) or die ("Could not execute query"); Tried replacing the variables with definite numbers and values, still doesnt work. I can echo the variables right before so I know they exists etc. I am connected to the DB, right table name and all. What'd i do? Thankyou Quote Link to comment https://forums.phpfreaks.com/topic/66755-solved-whats-wrong-with-my-update-code/ Share on other sites More sharing options...
nathanmaxsonadil Posted August 26, 2007 Share Posted August 26, 2007 change $query = "UPDATE table SET $this = $that WHERE id = $id"; to $query = "UPDATE table SET {$this} = '{$that}' WHERE id = '{$id}'"; Quote Link to comment https://forums.phpfreaks.com/topic/66755-solved-whats-wrong-with-my-update-code/#findComment-334521 Share on other sites More sharing options...
dumpty Posted August 26, 2007 Author Share Posted August 26, 2007 Great thanks!!! Quote Link to comment https://forums.phpfreaks.com/topic/66755-solved-whats-wrong-with-my-update-code/#findComment-334524 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.