I've written this code to list data from the utenti
table:
<?php
include("Database.php");
$sql = "SELECT * FROM utenti";
$rs = $conn->query($sql);
if($rs === false){
echo "Errore Sintassi SQL" . $conn->error;
}else{
$arr = $rs->fetch_all(MYSQLI_ASSOC);
}
foreach ($arr as $row){
echo "<br/>";
echo $row['id'];
echo "<br/>";
echo $row['nome'];
echo "<br/>";
echo $row['cognome'];
echo "<br/>";
}
?>
On my friend's computer, this works perfectly; but on my computer, I get this odd notice:
Notice: Undefined index:
id
intest.php
on line 15
What could be causing it to fail on only one computer, and how can I fix it?
This could possibly stop the undefined index error.
foreach ($arr as $row) {
foreach ($row as $value) {
echo "<br/>";
echo $value;
}
}