I'm trying to display results from a database in two columns but I can't seem to get it to work. I've seen some examples on here but they are very old and don't really follow what I'm doing. Below are the two errors I'm getting.All it outputs is the word "Array"
Notice: Undefined offset: 99 in G:\xampp\htdocs\carDirectory\listing.php on line 19
Notice: Array to string conversion in G:\xampp\htdocs\carDirectory\listing.php on line 23
<?php
include_once 'includes/dbh.inc.php';
include 'functions.php';
$sql = "SELECT * FROM roads ORDER BY roadName ASC";
$stmt = $mysqli->prepare($sql);
$stmt ->execute();
//stmt ->store_result();
//$stmt ->bind_result($roadID, $roadName, $reportingMark);
$result = $stmt->get_result();
//$mid = $result->num_rows;
$mid = ceil($result->num_rows/2);
while ($row = $result->fetch_row()) {;
$listing[] = $row;
}
for($i=0; $i<$mid; $i++){
$colOne = $listing[$i];
$colTwo = $listing[$i + $mid];//line 19
}
echo "<table>";
echo "<td>";
echo $colOne;//line 23
echo "</td>";
echo "<td>";
echo $colTwo;
echo "</td>";
echo "</table>";
//echo $data;*/
//printf("%s (%s)\n",$roadID, $roadName, $reportingMark);
$stmt->close();
$mysqli->close();
whileloop?