注意:未定义索引:页面位于C:\ xampp \ htdocs \ Project \ indexx.php中 第18行
注意:未定义索引:C:\ xampp \ htdocs \ Project \ indexx.php中的look4 在第19行
警告:mysqli_fetch_array()期望参数1为mysqli_result, 第23行的C:\ xampp \ htdocs \ Project \ indexx.php中给出的布尔值
警告:mysqli_fetch_assoc()期望参数1为mysqli_result, 在第30行的C:\ xampp \ htdocs \ Project \ indexx.php中给出的布尔值
请帮助,我只是想不通。附言我是初学者,请放心,我笑
<html><head>
<title>Showing blog entries</title>
<body>
<h2>Search</h2>
<form>Search only for titles including ... <input name="look4" id = "look4"
value="<?= htmlspecialchars(stripslashes($_REQUEST['look4'])) ?>">
<input type=submit></form><br>
<h2>Here are the entries you selected - page <?= $_REQUEST['page']+1 ?>:</h2><br>
</body>
</html>
<?php
$conn = mysqli_connect("localhost","root","");
mysqli_select_db($conn, "data");
$perpage = 10;
$html = "";
$startat = $_REQUEST['page'] * $perpage;
$limlim = "%".$_REQUEST['look4']."%";
$q = ("select count(entry_id) from cases where name like '$limlim' OR address like '$limlim' ");
$result = mysqli_query($conn, $q);
$row = mysqli_fetch_array($result);
$havesome = $row[0];
$pages = floor(($row[0]-1) / $perpage) +1 ;
$q = ("select * from cases where name like '$limlim' OR address like '$limlim' order by entry_id desc limit $startat,$perpage");
$results = mysqli_query($conn, $q);
while ($row = mysqli_fetch_assoc($results)) {
$text = strip_tags($row[entry_text]);
$text = substr($text,0,300);
$html .= "<dt>$row[name] - <a href=/index/$row[case]_.html target=pix>$row[phone]</a></dt>";
$html .= "<dd>$text ....<br><br></dd>";
};
$lynx = "Please choose the next page you want to view:";
for ($k=0; $k<$pages; $k++) {
if ($k != $_REQUEST[page]) {
$lynx .= " <a href=$PHP_SELF"."?page=$k&look4=".urlencode(stripslashes($_REQUEST[look4])).">".($k+1)."</a>";
} else {
$lynx .= " <b>--".($k+1)."--</b>";
}
}
if ($pages < 2) {
$lynx = "All results shown on this page";
}
if ($havesome == 0) {
$lynx = "Sorry - no titles matched. Please change your search string";
}
?>
<?= $html ?>
<?= $lynx ?>