-4

I use this query but I don't know how will I order this by DoctorName?

$q=mysqli_query($link,"Select * from doctor where status='". $stat ."'");
2

2 Answers 2

1

Add an ORDER BY statement to your query:

$q=mysqli_query($link,"Select * from doctor where status='". $stat ."' ORDER BY `doctor_last_name`");
0
0

Use the ORDER BY command to order by columns.

$q=mysqli_query($link,"Select * from doctor where status='". $stat ."' ORDER BY doctor_last_name");

You can add a list to the ORDER BY command to provide a hierarchy of order. Example:

SELECT * FROM EmployeeData ORDER BY Date, LastName, FirstName;

This command will sort by the Date column first. All matching dates will then be ordered by the LastName column. All possible records that Date AND LastName match will be ordered by the FirstName column and so on!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.