FURQAN Posted April 29, 2010 Share Posted April 29, 2010 hi there my name is furqan ahmed i have a problem in my php code "i actually wanna make my costumise database means i am getting a name with a text box and wanna make a table in the database of the name which the user have entered in the text box" following is the code <html> <head><title>page link</title></head> <body> <form method="post"> <input type="text" name="rollnumber" > <input type="submit" value="done" name="setup"> </form> <?php $conn=mysql_connect('localhost','root','') or die('cannot connect'); mysql_select_db('temp',$conn) or die('database is down'); echo'go a head'; echo'enter your epno. or roll number to setup your properties in the database'; if(isset($_POST['setup'])) { $table=$_POST['rollnumber']; echo $table; $query="CREATE TABLE FURQAN ( id INT(25), answer VARCHAR(15) )"; $re=mysql_query($query,$conn) or die('furqan ahmed go a head'); } ?> <a href="pagination1.php?go=0">start</a>; </body> </html> can any body help me please Quote Link to comment https://forums.phpfreaks.com/topic/200193-hi-there/ Share on other sites More sharing options...
andrewgauger Posted April 29, 2010 Share Posted April 29, 2010 I think you are saying you want to replace FURQAN with $table which is all you really need to do: $query="CREATE TABLE $table ( id INT(25), answer VARCHAR(15) )"; If not, what post variable is supposed to be the table name? Quote Link to comment https://forums.phpfreaks.com/topic/200193-hi-there/#findComment-1050781 Share on other sites More sharing options...
FURQAN Posted April 30, 2010 Author Share Posted April 30, 2010 yes i wanna do the same but it is not working can you telll me is it possible or nopt Quote Link to comment https://forums.phpfreaks.com/topic/200193-hi-there/#findComment-1051166 Share on other sites More sharing options...
mikesta707 Posted April 30, 2010 Share Posted April 30, 2010 it is indeed possible to create tables on the fly, However, I really have to ask why? how exactly is it "not working"? Is it are you getting an error? is the MYSQL failing (and thus showing the die() text, which is "go ahead ahmed" or something like that) If its the latter, change your die text with mysql_error() so you can see exactly whats going on Quote Link to comment https://forums.phpfreaks.com/topic/200193-hi-there/#findComment-1051172 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.