473,395 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Creating Table in Mysqldatabase Using PHP coding

190 100+
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 .....
Mar 13 '08 #1
5 1404
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 .....
Is the user just selecting a single datatype for all fields?

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?
Mar 13 '08 #2
TheServant
1,168 Expert 1GB
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 .....
Please post you code that you have, it wastes time trying to guess how you have written the code.
Mar 14 '08 #3
Shalini Bhalla
190 100+
<form method="GET" action="createtable.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>&nbsp;</td>
<td colspan="3">&nbsp;</td>
</td>
</tr>
<?
}

?>
<tr>
<td colspan="4"><input 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 .
Mar 14 '08 #4
yasmine
65
Please Post ur code within code tags.

Read POSTING GUIDELINES before u r posting threads.
Mar 14 '08 #5
Shalini Bhalla
190 100+
[HTML]
<form method="GET" action="createtable.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>&nbsp;</td>
<td colspan="3">&nbsp;</td>
</td>
</tr>
<?
}

?>
<tr>
<td colspan="4"><input 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 .
Mar 14 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Edvard Majakari | last post by:
Greetings, fellow Pythonistas! I'm about to create three modules. As an avid TDD fan I'd like to create typical 'use-cases' for each of these modules. One of them is rather large, and I wondered...
0
by: slysql | last post by:
I have an Access 2000 application that uses sql server as back end. We're trying to avoid using ODBC to set up linked tables in access. Is udl an alternative way? I set up the udl file but don't...
3
by: Robin S. | last post by:
This is more of a structural question (me: newbie) as opposed to specific coding. Please be patient... I'm making a database for the small company I work for. It will be to add and edit products...
12
by: enak | last post by:
I have found some code that shows how to convert an html form to Word. The message said to simply put the following in the Page_load: Response.ContentType = "application/ms-word"...
14
by: Luciano A. Ferrer | last post by:
It is ok tu use a table tag inside a form tag? (you know, you do not use h2 inside p, etc...) -- Luciano A. Ferrer laferrerQuiTadme@SacaDMEgmail.com .... un todo en uno y uno en todo
18
by: TORQUE | last post by:
Hi, Im wondering if anyone can help me with a problem. I have a form with more than 50 unbound fields. Some of the fields will be blank from time to time. This seems to be where im having...
1
by: bdub7989 | last post by:
Hi, I am about as green as they come in using VBA and have encountered an area that leaves me scratching my head. Below is my situation and what I would like to do; I just don't really know how to...
32
by: Joe | last post by:
I am just starting to use Object Oriented PHP coding, and I am seeing quite often the following (this example taken from a wiki): $wakka =& new Wakka($wakkaConfig); What exactly is the =&, and...
2
by: divyac | last post by:
I have developed an address book using php and mysql.I have all the contacts list in a table with check boxes.Now that i want to create mailing labels for the checked contacts...i.e.,the arrangements...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.