【发布时间】:2013-12-31 13:20:02
【问题描述】:
我在运行代码时收到此错误。
错误:
警告:mysqli_real_escape_string() 需要 2 个参数,1 个在 C:\wamp\www\SearchEngine\search.php 第 11 行给出
代码:
<?php
//php code goes here
include 'connect.php'; // for database connection
include 'script_suggestion.php';
include 'script_close_suggestion_box.php';
$query = $_GET['q']; // query
$button = $_GET ['submit'];
if (isset($_GET['page'])) {
$page_number = (int)$_GET['page'];
$page_number = mysqli_real_escape_string($page_number);
}
else
$page_number = 1;
$results_per_page = 3;
?>
我该如何解决这个问题?
【问题讨论】:
-
无论如何,你应该使用准备好的语句,而不是手动转义