私の結果はSQL文で "ORDER BY prod_name"でソートする必要がありますが、動作させることはできません。私はORDER BYをMYSQLクエリに挿入するには
$thisProduct .= " AND prod_type = 1 ORDER BY prod_name";
後も
$thisProduct .= " AND ID = '" . mysql_real_escape_string($_GET['product']) . "' ORDER BY prod_name";
後にしようとしたしかし、私は私の結果が正しくソートすることができません。間違った場所に注文したのですか、DBを間違ってクエリしましたか?
進んでいただきありがとうございます。MYSQLのクエリではまだかなり新しいです。
$thisProduct = "SELECT prod_name AS Name, days_span, CONCAT(LEFT(prodID,2),ID) AS ID, geo_targeting FROM products WHERE status = 'Active' AND vendID = ".$resort['vendID'];
if (isset($_GET['product']) AND is_numeric($_GET['product'])) {
$thisProduct .= " AND ID = '" . mysql_real_escape_string($_GET['product']) . "'";
}
else {
$thisProduct .= " AND prod_type = 1";
}
$thisProduct .= " LIMIT 1";
$getThisProduct = mysql_query($thisProduct);
if (!$getThisProduct/* OR mysql_num_rows($getThisProduct) == 0 */) {
header("HTTP/1.0 404 Not Found");
require APP_PATH . '/404.html';
die();
}
$thisProductData = mysql_fetch_assoc($getThisProduct);