This was working fine before and now it's not. I'll try explain the problem best I can.
I am creating a website where people post ads for horses they are trying to sell, or put on loan - people can also post if they are looking for a specific horse. I am using this code to create a new ID once an advert has been posted, because once the ad is posted, it takes them to a page where they can upload a picture. This part of my code isn't working.
if ($conn->query($sql)) {
// echo "New Record has id ".$conn->mysqli_insert_id;
$_SESSION['hid'] = $conn->mysqli_insert_id;
$conn is the variable I use when connecting to the DB so no problem there. No ID is being generated but yesterday it was fine and nothing changed since then. Any tips or anything I could be doing wrong?