0

I program something in my own laptop(apache,Ubuntu Os) (with php,CodeIgniter) and it will order result by DESC,but when I ran it on other computer (easyphp,win32) it didn't do it.

so I have not same result ,where is the problem and how should I solve it?

I don't wanna use order id by desc

Moein Hosseini
  • 4,309
  • 15
  • 68
  • 106
  • 5
    `order id by desc` isn't valid syntax. – PeeHaa Nov 02 '11 at 14:47
  • 4
    Why dont you want to use order by ? thats the only certain way to order data across multiple databases – Manse Nov 02 '11 at 14:47
  • 5
    Your question sounds like you do not want to use `ORDER BY` at all. In this case you cannot ensure a particular order. If you only order by non-unique fields you also cannot ensure the order of rows where all fields listed in the ORDER statement are unique. – ThiefMaster Nov 02 '11 at 14:48
  • why the same code have different problem in two computers. – Moein Hosseini Nov 02 '11 at 14:59
  • 1
    @Moein7tl: "why does the inside of my neighbor's house look different than the inside of my house? They're both houses!" Compare the MySQL settings on the two machines, compare the table setup, etc... – Marc B Nov 02 '11 at 15:01

1 Answers1

0

If you want to get a consistent record order with a MySQL query, you must use the ORDER BY clause. If you refuse to use it, then you must write a sorting function in your script (to use with the usort() PHP function) to sort the data consistently.

WWW
  • 9,734
  • 1
  • 29
  • 33