1

Currently have code that when runs tells me I have an undefined index error on line 12 for 'total_fl_qc'... the column in my sql table is named that exact same thing along with the query that inserts that specific row in the column, not sure why it's telling me undefined is there a hidden syntax error I can't seem to find? And Also the data prints

code

<?php
 include 'action.php';

$sql = "SELECT * FROM records";


$result = $conn->query($sql);

if($result->num_rows>0){
    while($row = $result->fetch_assoc()){

echo $row['date'], $row['hour'], $row['pnp_kdt'], $row['fl_built'], $row['fl_qc'], $row['total_fl_built'], $row['total_fl_qc'], $row['percentage']."<br>";
    }
}

else { echo "NAN result";}
$conn->close();

?>

And I will deal with the SQL injection later... no need to mention it only the syntax problem, thanks.

  • 1
    It simply means `total_fl_qc` index is missing from the `$row`. Try `var_dump($row)` on the first line of the `while` loop to display the indexes. – benjamintemitope Jul 05 '22 at 21:04
  • "...deal with the SQL injection later..." `"SELECT * FROM records"`—about as safe as you can get. – bloodyKnuckles Jul 05 '22 at 21:05
  • `I will deal with the SQL injection later.`...this particular code has no SQL injection vulnerabilities anyway. Not sure what you think the vulnerability is? – ADyson Jul 05 '22 at 21:31

0 Answers0