I have simplified my problem into the following code:
$sql_abc = "CREATE TABLE $tbl_abc(
x INTEGER(255)
)
";
echo "About to execute $sql_abc";
if (mysqli_query($conn, $sql_abc)) {
echo "Table $sql_abccreated successfully<br>";
} else {
echo "Error creating table: " . mysqli_error($conn) . "<br>";
}
for ($x = 1; $x <= 10; $x++) {
$sql_abc = "INSERT INTO $tbl_abc VALUES ($x)";
}
if (mysqli_query($conn, $sql_abc)) {
echo "New records created successfully<br>";
} else {
echo "Error: " . $sql_abc. "<br>" . mysqli_error($conn);
}
I am trying to get 10 records in the table, with each incrementing by one in the 'x' field.
However, all I see is:
Please advise. Thank you.

$xit should also execute the insert statement as well, right now the loop completes it's iterations and the insert statement only executes for the last value of$xbecause your insert statement is after the for loop$sql_abc = "INSERT INTO $tbl_abc VALUES ($x)";not currently in thefor ($x = 1; $x <= 10; $x++)loop? Thank you!"INSERT INTO $tbl_abc VALUES ($x)"query string ?