嗨,这是我第一次尝试php,所以如果这是一个新手的错误,请道歉,但每当我搜索时,我都会收到此错误。请帮忙谢谢。
注意:未定义的索引:在第63行的C:\ xampp \ htdocs \ database.php中搜索
警告:mysql_fetch_array()要求参数1为资源,布尔值在第69行的C:\ xampp \ htdocs \ database.php中给出
<form action="database.php" method="get">
<div align="center">
<input type="text" name="search" placeholder="search by roll no or name">
<input type="submit" name="sub" value="search now">
</div >
</form>
<?php
mysql_connect("localhost","ahmad","");
mysql_select_db("webeng");
if(isset($_GET ['sub'])){
这是63:
$search= $_GET[ 'search'];
$query= "select * from student where roll_no='$search' or student_name='$search'";
$run= mysql_query($query);
这是70:
while($row1=mysql_fetch_array($run)) {
$student_name= $row1['student_name'];
$school_name= $row1['school_name'];
$roll_no= $row1['roll_no'];
$result= $row1['result'];
}
?>
<table width="600" border="0" align="center" bgcolor="orange">
<tr>
<td><?php echo $student_name;?></td>
<td><?php echo $school_name;?></td>
<td><?php echo $roll_no;?></td>
<td><?php echo $result;?></td>
</tr>
</table>
<?php } ?>