x_wd11 Posted October 3, 2019 Share Posted October 3, 2019 Would you know how to extract the number of user that is in a particular table? $q = "SELECT COUNT(user) FROM table1 WHERE user = 'glenn'"; $r = @mysqli_query($dbc, $q); //$num = mysqli_num_rows($r); //$id = mysqli_fetch_field($r); //$id = mysqli_fetch_array($r); $id = mysqli_fetch_assoc($r); echo 'r user number '. $r .'<br>'; echo 'n user number '. $num .'<br>'; echo 'n user number '. $id .'<br>'; I get different errors BUT no result! Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in Thank you much. Link to comment Share on other sites More sharing options...
x_wd11 Posted October 3, 2019 Author Share Posted October 3, 2019 Instead giving me some warnings, shouldn't it tell me it is not connected to DB! I believe that what it did before, my old setup, I guess something changed that is different from the old. Sorry for bugging you with details. Link to comment Share on other sites More sharing options...
Larry Posted October 4, 2019 Share Posted October 4, 2019 If you remove the error suppression operator, you'll see the error messages. You should probably also use some conditionals in there, such as checking that mysqli_num_rows() returns 1 or more records before you attempt to fetch them. Link to comment Share on other sites More sharing options...
Recommended Posts