I am trying to count the number of rows I am selecting from the database and write a Foreach loop if the number of rows is greater than 1. I keep getting an unexpected ')' error. Why is this?
<?php
if(isset($_SESSION['login_user'])) {
$login_session = $_SESSION['login_user'];
echo '<h1>Welcome '. $login_session .'</h1>';
}
echo '<table>';
$sql_query = "SELECT * FROM Courses";
$result = mysqli_query($dbconfig, $sql_query);
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
$count = mysqli_num_rows($result);
if($count > 1) {
foreach($result as $row)
echo '<tr>'. $row['Title'] .'</tr>';
}
}
echo '</table>';
?>
The exact error is:
[12-Aug-2016 09:54:29 Europe/London] PHP Parse error: syntax error, unexpected '}' in /home/etd/public_html/etd/single/courses.php on line 33