hi friends , i have created simple program that will create table using class.


  --> How to run :
1. Save both page as given name "index.php" and "welcome.php" accordingly their given code
2. Then run input.php from your browser
3. Enter name of field you want to create in first textbox
4. Then enter proper data type in second textbox
5. Press submit button your table is created.

6. If error create proper database and table

=========================
Code:

input.php  
======
<form action="welcome.php" method="post">
Field 1 (name): <input name="txtf1"/><br>
Field 2 (datatype): <input name="txtf2"/><br>
<input name="btnsubmit" value="Submit" />
</form>



welcome.php
==========
<form action="input.php" method="post">
<input value="previous" name="btnprev"/>
<br/><br/>
</form>
<?php
class connection
{
    var $f1;
    var $f2;
    function display()
    {
    $f1 = $_POST["txtf1"];
    $f2 = $_POST["txtf2"];
    mysql_connect("localhost","root","");               //enter server name and user and password
    mysql_select_db("example");                   //enter your database name
    $query1 = "drop table temp;";
    mysql_query($query1);
    $query = "create table temp(".$f1." ".$f2.");";
    if(mysql_query($query))
        echo "Table created successfully";
    else
        echo "Error :",mysql__error();
    }
}

$con = new connection();
$con->display();
?>