私はこのmySQLクエリを持っています
SELECT list.*, brand.displayed_text AS brandName
FROM itemmaster_list AS list
LEFT JOIN brand_lists AS brand ON brand.cid = list.brandcode
WHERE brandcode = 'abc'
ORDER BY list.orderpriority DESC, list.date_added DESC , list.cid DESC
これを PHPMySQL で実行すると、フィールドで正しくソートされたデータが返されます[list.orderpriority]
しかし、私のphpコードで(ブラウザを介して)実行すると、フィールドごとにデータがソートされます[list.date_added]
PHPコード
$result_item = mysql_query("SELECT list.*, brand.displayed_text AS brandName FROM itemmaster_list
AS list LEFT JOIN brand_lists AS brand ON brand.cid = list.brandcode WHERE brandcode = 'abc'
ORDER BY list.orderpriority DESC, list.date_added DESC , list.cid DESC") or die(mysql_error());
if (mysql_num_rows($result_item) > 0) {
while($row_item = mysql_fetch_array($result_item)) {
[echo here the records]
}
}