neocamel Posted August 13, 2009 Share Posted August 13, 2009 Hello all. Hope I'm in the right section, this is my first post here! I'm having syntax problems. I'm basically trying to use a php variable to define the table in a mysql UPDATE statement. Anyone know how to accomplish this? I tried something like... $whatclient=mysql_real_escape_string($_POST['theclient']); $sql="UPDATE $whichclient SET name = '$name' , email = '$email'"; basically "theclient" is the result of the user choosing a drop down option, I'll name the tables after the drop down choices' values. Thanks so much in advance for the help! Quote Link to comment Share on other sites More sharing options...
Alex Posted August 13, 2009 Share Posted August 13, 2009 You defined $whatclient, then used $whichclient in the sql statement. Quote Link to comment Share on other sites More sharing options...
neocamel Posted August 13, 2009 Author Share Posted August 13, 2009 Oh my apoligies, thats a typo. Let me correct. $whichclient=mysql_real_escape_string($_POST['theclient']); $sql="UPDATE $whichclient SET name = '$name' , email = '$email'"; Sorry about that, I'm on hour 5 of this project and am burning out! 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.