我想在mysql数据库中搜索一个阿拉伯文字当我做查询它运行完美,如果我把这个词我自己但是当使用POST变量时我得到这个错误 mysqli_fetch_array()期望参数1被mysqli_result,布尔给 这是我的代码:php mysql阿拉伯语搜索
<form method="post" action="closedreq.php" target="_self">
<p>Search For Request : </p>
<input type="text" name="search" />
<input type="submit" value="Submit" name="submit" id="submit" />
</form>
</div>
<?php
if (isset($_POST['submit'])){
$search = $_POST['search'];
$sql = mysqli_query($con,"select * from new_req where status = '0' AND (id = $search or req_city = $search
or req_location = $search or req_date = $search) order by id desc");
当我回声变量输出是像什么,我想
请参阅[此答案](http://stackoverflow.com/a/11674313/250259)了解如何解决此问题。 –
不,当我搜索其他英文的东西时,它的工作原理 –
你的代码可以被SQL注入,并且会被滥用。神奇地将'mysql_'改为'mysqli_'并不能解决这个问题。使用准备好的语句并绑定变量,或者至少在您的字符串中使用'mysqli_real_escape_string',然后将它们粘贴到查询中。 – h2ooooooo