Alright, so I got MySQL v. 4.0.18-standard, and php 4.3.4 as background.
What I'm tryin to do is create a script that'll create a table thru a table. Some people may have the PHP fast & easy development and I'm trying to copy the one that they have in the book.
I've looked at the php.net, and it didn't really answer my question though.
Here's the error I get.
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 't (Array[0]),)' at line 1
This is in the table creation script
PHP Code:
$sql = "CREATE TABLE $_POST[table_name] (";
for ($i = 0; $i < count($_POST[field_name]); $i++) {
$sql .= "$_POST[field_name][$i] $_POST[field_type][$i]";
if ($_POST[field_length][$i] != "") {
$sql .= " ($_POST[field_length][$i]), ";
} else {
$sql .= ", ";
}
}
and heres my form sorta deal. It used to have a dropdown menu, but I thought that may be part of the issue, but it isn't I think.
This is in the table selection field.
PHP Code:
for($i = 0; $i < $_POST[num_fields]; $i++) {
$form_block .= "
<TR>
<TD ALIGN=CENTER><INPUT TYPE=\"text\" NAME=\"field_name[]\" SIZE=\"30\"></TD>
<TD ALIGN=CENTER><INPUT TYPE=\"text\" NAME=\"field_type[]\"> </TD>
<TD ALIGN=CENTER><INPUT TYPE=\"text\" NAME=\"field_length[]\" SIZE=\"5\"></TD>
If you need to see anymore code or got any questions, I'll try my best to answer them.
If you have any references about this that I can look at, I would be greatly appriciative.