INSERT INTO ~~ Problem
Posted: Tue Sep 09, 2008 11:57 am
Hey guys,
Need some help,
Im trying to insert into a table where a user choose the table
example like this,
//this is the form
<form method="POST">
<input type="text" name="department" >
<input type="text" name="name" >
<input type="int" name="ic" >
<input type="varchar" name="diagnosis" >
</form>
//then insert into the table where the table itself chosen by the user
$insert = "INSERT INTO "'.$_POST['department'].'" ( name, ic, diagnosis);
$add= mysql_query($insert);
can i use the code that i had high lighted in BLUE in the INSERT INTO coding??
I try many times but when i check my database, no data where inserted into the chosen table
but if i replaced the BLUE coding with the name of the table DIRECTLY, it does work....
huhuhu...help me guys...
thanks
azhan
Need some help,
Im trying to insert into a table where a user choose the table
example like this,
//this is the form
<form method="POST">
<input type="text" name="department" >
<input type="text" name="name" >
<input type="int" name="ic" >
<input type="varchar" name="diagnosis" >
</form>
//then insert into the table where the table itself chosen by the user
$insert = "INSERT INTO "'.$_POST['department'].'" ( name, ic, diagnosis);
$add= mysql_query($insert);
can i use the code that i had high lighted in BLUE in the INSERT INTO coding??
I try many times but when i check my database, no data where inserted into the chosen table
but if i replaced the BLUE coding with the name of the table DIRECTLY, it does work....
huhuhu...help me guys...
thanks
azhan