Hey there, first post here.
This is a simple code (I’m a beginner) that I’ve been writing with a video tutorial:
<?php
$con = mysqli_connect(“localhost”,”username”,”blabla”,”db”);
//getting the categories
function getCats(){
global $con;
$get_cats = “select * from categories”;
$run_cats = “mysqli_query($connection, $get_cats);
while ($row_cats = mysqli_fetch_array($run_cats)){
$cat_id = $row_cats [‘cat_id];
$cat_title = $row_cats [‘cat_title];
echo “<li><a href=”#”>cat_title</a></li>”;
}
}
?>
The error points up to “echo “<li><a href=”#”>cat_title</a></li>”;” saying PHP Parse error: syntax error, unexpected ‘>’ . The thing is, this is exactly written in the same way as the video tutorial. This keeps giving me this error and I believe it’s the reason when I try to include this function on my html page all the content disappears.
Thanks in advance.