Adam Kona Adam Kona - 17 days ago 5x
MySQL Question

How do I output the result from an sql query onto the screen in php

The following is the code I use to try and achieve this.

// Check connection
if (mysqli_connect_errno())
echo "Failed to connect to MySQL: " . mysqli_connect_error();

echo "we connected";

// Perform queries
$sql=mysqli_query($con,"SELECT * FROM ListedProperties");

echo $result['*'];



I'm new to php and i'm sure it's something small, I just can't see it.


Use PHP foreach loop like this:

foreach($result as $key => $val)
     print $val;