0

I have a database and the following php code:

$result = mysqli_query($link, 'SELECT * FROM database ORDER BY Score DESC');
while ($row = $result->fetch_assoc()) {
   printf ("%s;%s\n", $row["Name"], $row["Score"]);
}

The database has rows Name as string and Score also as a string.

The Problem is the Score is not sorted correctly. Why?

3
  • 1
    Please remember that we cannot see your screen. You need to include in the question every relevant detail. The ORDER BY clause is not generally broken. Commented Jan 30, 2022 at 14:16
  • Please show us some "wrong" output :) Commented Jan 30, 2022 at 14:17
  • 1
    My one guess is that you have numeric strings: stackoverflow.com/a/5418033/231316 Commented Jan 30, 2022 at 14:20

1 Answer 1

0

change score column type to int

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.