Can't fetch from two tables using php

Hello could someone help me know what could be a ploblem. I am getting Warning: mysqli_query(): Couldn’t fetch mysqli error.

// displaying list of regions and councils from database
$sql= "SELECT Regions.regioncode, Regions.regionname, Councils.councilcode, Councils.councilname FROM Regions INNER JOIN Councils ON Regions.regioncode = Councils.regioncode";
$result = mysqli_query($mysql_id,$sql);
if ($result->mysqli_num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
    	echo "<tr"."id="."data".">".

} else {
    echo "No region available";

// ending if statement


// end the connection after displaying the list of reports

echo "</table>";
1 Like


while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC))

1 Like