我应该把WHERE
条款放在哪里。
$sql=("SELECT * FROM students LIMIT $startResults, $resultsPerPage");
我应该把WHERE
条款放在哪里。
$sql=("SELECT * FROM students 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 注入攻击......
SELECT * FROM students WHERE character='willing to learn' AND Age < 35 LIMIT $startResults, $resultsPerPage
WHERE
和(如有必要)AND
插入
尝试,
$sql=("SELECT * FROM students WHERE <where_condition> LIMIT $startResults, $resultsPerPage");