creating DB table by giving input from php text box
<p>I want to make a table in a database, by giving the name of that table as an input from a text box.  </p>

<pre><code>&lt;?php
$tablename = $_POST['tablename'];

    // Create a MySQL table in the selected database
    mysql_query("CREATE TABLE $tablename(
    id INT NOT NULL AUTO_INCREMENT, 
    PRIMARY KEY(id),
    firstpublish VARCHAR(255), 
    descriptions VARCHAR(255))") or die(mysql_error());  
?&gt;
</code></pre>

<p>it makes the table and the field, but i can't insert any data in it. When i run the code below</p>

<pre><code>&lt;?php
$firstpublish = $_POST['firstpublish'];
$descriptions = $_POST['descriptions'];

if(isset($_POST['firstpublish']) || ($_POST['descriptions']))
    {   
$order="INSERT INTO $tablename (id,firstpublish,descriptions) VALUES ('','$firstpublish','$descriptions')";
    $result = mysql_query($order) or die (mysql_error());
    }
?&gt;
</code></pre>

<p>it showing an error message</p>

<p>"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 '( id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), firstpublish VARCHA' at line 1"
 how can i fixed this problem.</p>

<p>-thankyou.</p>
