I am trying to create a table in mysql using php , but the problem is that no. of fields and their datatype is taken from user in input form in am array .so , i want to know that how should i create a table , how should i specify feild names and datatype in string .Pls Help .....
Creating Table in Mysqldatabase Using PHP coding
Collapse
X
-
Tags: None
-
Is the user just selecting a single datatype for all fields?Originally posted by Shalini BhallaI am trying to create a table in mysql using php , but the problem is that no. of fields and their datatype is taken from user in input form in am array .so , i want to know that how should i create a table , how should i specify feild names and datatype in string .Pls Help .....
Also, a little more background info could help. How will the table be used? Are there any fields that need to be added in addition to those chosen by the user, like a uid column? -
Please post you code that you have, it wastes time trying to guess how you have written the code.Originally posted by Shalini BhallaI am trying to create a table in mysql using php , but the problem is that no. of fields and their datatype is taken from user in input form in am array .so , i want to know that how should i create a table , how should i specify feild names and datatype in string .Pls Help .....Comment
-
<form method="GET" action="createt able.php">
<?
$i = 0 ;
for ($i = 0; $i<=$no ; $i++)
{ ?>
<table width="456">
<tr>
<td>Name:</td>
<td><input type='text' name='Fname[$i]'> <input type='hidden' name='tname' value="$tname" ></td>
<td>Data Type :</td>
<td><input type='text' name='Dtype[$i]' /></td>
</td>
</tr>
<tr>
<td> </td>
<td colspan="3">&nb sp;</td>
</td>
</tr>
<?
}
?>
<tr>
<td colspan="4"><in put type='submit' name=Submit></td>
</td>
</tr>
</table>
</form>
This is my Form which takes input of no of columns and data type from user and after that i want to create a table in my database , yes i do need to give choice of primary key .Comment
-
[HTML]
<form method="GET" action="createt able.php">
<?
$i = 0 ;
for ($i = 0; $i<=$no ; $i++)
{ ?>
<table width="456">
<tr>
<td>Name:</td>
<td><input type='text' name='Fname[$i]'> <input type='hidden' name='tname' value="$tname" ></td>
<td>Data Type :</td>
<td><input type='text' name='Dtype[$i]' /></td>
</td>
</tr>
<tr>
<td> </td>
<td colspan="3">&nb sp;</td>
</td>
</tr>
<?
}
?>
<tr>
<td colspan="4"><in put type='submit' name=Submit></td>
</td>
</tr>
</table>
</form>
[/HTML]
This is my Form which takes input of no of columns and data type from user and after that i want to create a table in my database , yes i do need to give choice of primary key .Comment
Comment