How come my mySQL query will only take 7 columns? Every time I attempt to add an 8th column name, the page breaks. Example:
Does NOT work:
$result = mysqli_query($conn, "SELECT name, fibre, sugar, img, kcal, carbs, protein, fat FROM table");
$names = array();
$fields_num = mysqli_num_fields($result);
if(mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_assoc($result)) {
$names[] = $row;
}
} else {
echo "0 results";
}
Does Work: See 'fat' removed from query
$result = mysqli_query($conn, "SELECT name, fibre, sugar, img, kcal, carbs, protein FROM table");
$names = array();
$fields_num = mysqli_num_fields($result);
if(mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_assoc($result)) {
$names[] = $row;
}
} else {
echo "0 results";
}
I have also tried with different column names from the table, but it doesn't matter, they still don't work. Yes, the columns are all spelled right.
Is there any way I can query more then 7 column names? ALSO: using mysqli_query($conn, "SELECT * FROM table");
Does not work either!?!? What is going on here??