I want to use variable value in a query but for something not often happens like that:
$sql ="select a from x where b ='".$_SESSION["b"]."' Limit '".$_GET["l"]."',1;";
How to set the input of limit
properly because it seems to me not working unless there is =
before the input.
Your current query will generate
Limit '5',1
Which is invalid SQL, it has to generate
Limit 5,1
Go Figure. And Oh How can I prevent SQL injection in PHP?
从句子Limit ".$_GET["l"].",1;"
删除“”,这样在MySQL中使用limit。
$sessionvar = $_SESSION['b'];
$limit = $_GET['1'];
$sql ="select a from x where b = $sessionvar Limit $limit ,1";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.