So I have a tabel with 10 Rows in it,
They look like this :
+++++++++++++++++++++++++++++++++++++++
+ ID + ACTIVE + NAME + DESCRIPTION +
+++++++++++++++++++++++++++++++++++++++
+ 1 + 1 + ONE + O-N-E +
+++++++++++++++++++++++++++++++++++++++
+ 2 + 2 + TWO + T-W-O +
+++++++++++++++++++++++++++++++++++++++
+ 3 + 0 + THREE+ T-H-R-E-E +
+++++++++++++++++++++++++++++++++++++++
+ 4 + 4 + FOUR + F-O-U-R +
+++++++++++++++++++++++++++++++++++++++
+ 5 + 5 + FIVE + F-I-V-E +
+++++++++++++++++++++++++++++++++++++++
+ 6 + 3 + SIX + S-I-X +
+++++++++++++++++++++++++++++++++++++++
I'm getting the values of this table by using
$result = mysql_query("SELECT * FROM Table WHERE ACTIVE != 0") or die (mysql_error());
And then I'm fetching them with :
$values = mysql_fetch_array($result) or die (mysql_error());
But now the problem is, that the come out this way : 1 2 4 5 3
And I would like to order this while keeping the NAME and DESCRIPTION that belong to the ACTIVE .
I've read a little bit about sorting 2D array's but I'm not getting anywhere, so if anyone has a clear solution or clear article that would help me alot! Thanks for reading.
ORDER BYmysql_*functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which.