有人能教我如何清理查询吗?我也应该消毒$first_word吗?
$question_text = sanitize($_POST['question_text']);
list($first_word) = explode(' ', $question_text);
$qStuff=mysql_query("SELECT c.field_name,t.category_name, d.domain_name FROM category_fields c, taxonomy_category t, taxonomy_domain d WHERE c.category_id = t.category_id AND t.domain_id = d.domain_id AND c.field_name = '$first_word'");
最佳答案
使用PDO和参数绑定,如下所示:
$sql = "INSERT INTO table (field) VALUES (?)";
$sth = $dbh->prepare($sql);
$sth->execute(array($value));
关于php - 如何清理以下查询?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5374170/