I have two files: Table creation and Table insert
One creates a table with rows, and the other inserts data into those rows
Rather than editing the rows name/type in each file, I tried including rows.php but I get an error
rows.php looks like this:
Row1 CHAR(15),
Row2 CHAR(15),
Row3 CHAR(15),
**tablecreation.php looks like this:**
$sql = "CREATE TABLE TableTest
(
<?php include 'rows.php'; ?>
)";
**tableinsert.php looks lkike this:**
$sql = "INSERT INTO TableTest
(
<?php include 'rows.php'; ?>
)";
The syntax for create table
and for insert
with a column list are different.
The create table
statement has data types. The insert
statement does not.
So, the following generates an error:
insert into TableTest(Row1 char(15), . . .)
Because the data type is not allowed in that context.