Home ORDER BY is not working for mysql table

# ORDER BY is not working for mysql table

Rohan Akut
1#
Rohan Akut Published in 2018-01-12 23:54:56Z
 I have a dummy database saved in phpmyadmin.I am trying to sort the data on the basis of column user_uid. Here is some of my database The php code that i am using to sort the table is
aendeerei
2#
 Your code shows only one record. Here is a working example making use of the needed while loop to display the client_name of each fetched record: include_once 'dbh.inc.php'; $sql = 'SELECT * FROM client ORDER BY user_uid';$result = mysqli_query($conn,$sql); if ($result->num_rows > 0) { while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { echo$row['client_name'] . '
'; } } I removed all the unneeded parenthesis around the vars and the semicolon at the end of the sql statement. Good luck. Edit 1: I corrected $connection to$conn. Edit 2: I implemented the check on the number of rows ($result->num_rows > 0) instead of on the$result itself (which is always an object of type mysqli_result and whos check therefore always returns true - even when no records are found).