-1
我有我的我的网站上搜索一个问题,我不明白为什么它给我这个错误搜索用PHP在我的网站
这是我的表单代码
<form action="index.php?cat=search_results&learn_id=1" method="post">
<div id="topSearchBodyStyle">
<input type="text" name="search" class="topSearchTextBackground" />
</div>
<div id="topSearchButtonStyle">
<input type="submit" name="submit" class="topSearchButtonBackground" value="" />
</div>
</form>
,这是其中有PHP代码页
<?php
$getSearch = $_POST['search'];
trim($getSearch);
if(!get_magic_quotes_gpc()) {
$getSearch = addslashes($getSearch);
}
$connectToDb = "select * from tutorials where tutorial_title like '%.$getSearch.%'";
$searchResults = $db->query($connectToDb) or die($db->error);
if ($searchResults){
$numResultas = $searchResults ->num_rows;
echo "<p>Found : " . $numResultas . "</p>";
while($row = mysqli_fetch_array($searchResults)) {
echo $row['tutorial_title'];
}
}else{
echo "cant connect";
}
?>
任何想法,为什么给我这个备注“未定义指数:搜索” ,为什么结果出来“0”
是的谢谢AndrewR你说得对,这工作很好,谢谢你的努力,我的兄弟。 – 2012-04-06 15:31:56