0
以及我的功能是本MySQL查詢與2argument
function all_products($where, $condition, $where2, $condition2) {
$query = "SELECT *
FROM `product`
WHERE
".mysql_real_escape_string($where)." = '".mysql_real_escape_string($condition)."'
and
".mysql_real_escape_string($where)." = '".mysql_real_escape_string($condition)."'
";
$query_run = mysql_query($query);
return $query_run;
}
所以每當我試着去使用此功能來獲取數據從數據庫返回即使只有$地點和$條件爲真行$ where2和$ condition2是錯誤的。
檢查你的第二個條件應該是:'「.mysql_real_escape_string($ where2)。」 ='「.mysql_real_escape_string($ condition2)。」'' - 你也容易受到SQL注入攻擊。請參閱:http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php –
瞭解它:D thanx – Sachin