Jump to content

[SOLVED] create mysql table in php


daveh33

Recommended Posts

Trying to create a mysql table - I have the below code so far: -

 

$name = $_POST['name'];
$newtablename = "$name_numbers";
$query1="CREATE TABLE $newtablename (number varchar(11) NOT NULL)";
$result = mysql_query($query1) or die(mysql_error());

 

What I am trying to do - is use the POST data to create a table E.G Orange_numbers

                              - There is only 1 field required in the table, called number

 

I just get the below error: -

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(number varchar(11) NOT NULL)' at line 1

 

Link to comment
https://forums.phpfreaks.com/topic/84454-solved-create-mysql-table-in-php/
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.