Jump to content

PHP variable in mysql UPDATE statement?


neocamel

Recommended Posts

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!

 

Link to comment
https://forums.phpfreaks.com/topic/170171-php-variable-in-mysql-update-statement/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.