Hi i'm trying to echo 2 cols selected from a mysqli query but it looks like i'm doing something wrong.
require('db_access.php');
$result = mysqli_query($db_connection, "SELECT id, intestatario FROM fatture_intestatari");
mysqli_close($db_connection);
$c = mysqli_num_rows($result);
if ($c == 0){ echo "Address book is empty";}
else {
while($row = mysqli_fetch_array($result)){
echo "<a href='#' onClick='get_holder_info('".$result['id']."');'>".$result['intestatario']."</a><br />";
};
};
Using this i get a "Fatal error: Cannot use object of type mysqli_result as array" That is gone if i use
require('db_access.php');
$result = mysqli_query($db_connection, "SELECT id, intestatario FROM fatture_intestatari");
mysqli_close($db_connection);
$c = mysqli_num_rows($result);
if ($c == 0){ echo "Address book is empty";}
else {
while($row = mysqli_fetch_array($result)){
echo "<a href='#' onClick='get_holder_info('".$result->id."');'>".$result->intestatario."</a><br />";
};
};
but still it doesn't echo all the values in the cols like it should. Any suggestions? Thanks