I'm trying to figure out why I'm receiving this error when trying to echo data from a database table, but can't exactly see what I'm doing.
$query = "SELECT * from web_projects"; // Select all rows from web_projects table
$result = mysqli_query ($con,$query);
while ($row = mysqli_fetch_array ($result)) {
foreach($row as $web) {
echo "<p>Name: ".$web->name."</p>";
echo "<p>Technologies: ".$web->tech."</p>";
echo "<p>Description: ".$web->description."</p>";
}
}
Theres only one row in the table, but when compiled I'm getting this:
Notice: Trying to get property of non-object in /Users/leecollings/Sites/leecollings.co/index.php on line 31 Name:
Notice: Trying to get property of non-object in /Users/leecollings/Sites/leecollings.co/index.php on line 32
etc
Have I missed something glaringly obviously?