I have the following code
$sql = "SET @uid := (SELECT ID FROM channels WHERE Used = 0 ORDER BY RAND() LIMIT 1);";
$sql = "UPDATE channels SET Used = 1 WHERE ID = @uid;";
$sql = "SELECT * FROM channels WHERE ID IN = @uid;";
$result = mysqli_multi_query($conn, $sql)
or die( mysqli_error($sql) );
if (mysqli_num_rows($result) > 0) {
$text = '';
while($row = mysqli_fetch_assoc($result)) {
$Channel_Location = $row['Channel_Location'];
$text = $text . $Channel_Location;
}
}
Now the issue i'm having is the php isnt displaying the result returned by the MYSQL query which is stored in a session later on in the code to be displayed on a dummy page it comes up with the following error
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result
The my SQL query does exactly what I need it to I just need to, so I don't really want to change it. I just need some advice on how i'd get the PHP to echo the @uid is there anyone willing to help me solve the issue? if so thankyou.
$result = mysqli_query($conn, $sql) or die(mysqli_error($conn));$sqlso you should usemulti_queryfunction$result = mysqli_multi_query($conn, $sql);and still no luck