I am trying to write some PHP that will run an SQL query and then count the number of rows that query returned and store it so i can use it in an if statement. Currently i am outputting the number onto the screen for debug reasons and it always outputs as 0 whereas when i run the query directly in the database it returns over 600 rows. Why is this?
$result = $db->query('SELECT * FROM `bets` WHERE `user` = 76561198223084096');
$row_cnt = $result->mysql_num_rows;
printf("Result set has %d rows.\n",$row_cnt);
Any help is appreciated
count(*)instead of*?$row_cnt = $result->mysql_num_rows;to$row_cnt = mysqli_num_rows($result);$db.