我應該在哪裏放置WHERE
子句。我應該在哪裏放置WHERE子句
$sql=("SELECT * FROM students LIMIT $startResults, $resultsPerPage");
我應該在哪裏放置WHERE
子句。我應該在哪裏放置WHERE子句
$sql=("SELECT * FROM students LIMIT $startResults, $resultsPerPage");
嘗試,
$sql=("SELECT * FROM students WHERE <where_condition> LIMIT $startResults, $resultsPerPage");
應該是這樣的:
$sql=("SELECT * FROM students WHERE (condition) LIMIT $startResults, $resultsPerPage");
...您的問題是一種模糊的,但....
通常人們做出查詢單個字符串,如果我猜你正在問什麼:
$sql="SELECT * FROM students WHERE `mysql_field`='$somevalue' LIMIT $number_of_results_you_want_returned";
記住上面的查詢並不妨礙對SQL injextion攻擊裸...
SELECT * FROM students WHERE character='willing to learn' AND Age < 35 LIMIT $startResults, $resultsPerPage
WHERE
和(如有必要)插入AND
你有沒有想過閱讀MySQL手冊上'選擇'聲明? – 2013-02-09 04:39:26
或者,您知道,使用Google? – 2013-02-09 04:42:15