Page 1 of 1

How to upload to an expecific table in mysql due to answer

Posted: Fri Feb 24, 2012 1:38 am
by ronald1989
I'm currently working with a form that i want it to update a table due to the answer provided by the user.

ex; if the user fill the form and says he is male, I want it to go to a table for males only and if the user answers female, then i would like it to go to a female only table on mysql database. can someone help me?

Re: How to upload to an expecific table in mysql due to answ

Posted: Fri Feb 24, 2012 6:07 am
by Celauran

Code: Select all

$gender = ((int) $_POST['gender'] == 1) ? 'male_table' : 'female_table';
$query = "UPDATE {$gender} SET blah blah whatever";