-1
我有一个使用工会在同一时间有两个querys工作,像这样的请求mysql_query:如何限制与工会的mysql_query
$friends_a = mysql_query("(SELECT * FROM users WHERE id!='$user_q[id]' AND id='$friends_1_q[user_one_id]') UNION ALL (SELECT * FROM users WHERE id!='$user_q[id]' AND id='$friends_1_q[user_two_id]')");`
,我想在一个只限制这个(两个querys限制),我会怎么做? (我已经尝试了很多我在互联网或这里找到的东西)。对不起,因为英文不好:D
[您的脚本存在SQL注入攻击风险。](http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php) –
请[停止使用' mysql_ *'functions](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php)。 [这些扩展](http://php.net/manual/en/migration70.removed-exts-sapis.php)已在PHP 7中删除。了解[编写](http://en.wikipedia.org/ wiki/Prepared_statement)语句[PDO](http://php.net/manual/en/pdo.prepared-statements.php)和[MySQLi](http://php.net/manual/en/mysqli.quickstart .prepared-statements.php)并考虑使用PDO,[这真的很简单](http://jayblanchard.net/demystifying_php_pdo.html)。 –
为每个查询添加一个“LIMIT”子句。 –