$dbname = "SELECT * FROM teacher WHERE (name LIKE '".$_GET["search"]."')";
$passwd = mysql_query($dbname) or die ("Error Query [".$dbname."]");
$sql=mysql_db_query($dbname, $sql); // บรรทัดนี้มีเพื่อ.???
Code (PHP)
while ($array = mysql_fetch_array($dbname)) // น่าจะ $array = mysql_fetch_array($passwd)
ลองแบบนี้ดู
Code (PHP)
<?php
if($_GET["search"] != "")
{
// Search By Name or phone
include ("config.php");
$sql = "SELECT * FROM teacher WHERE (name LIKE '%".$_GET["search"]."%')";
$query = mysql_query($sql);
?>
<table width="600" border="1">
<tr>
<th width="91"> <div align="center">Name </div></th>
<th width="98"> <div align="center">Level </div></th>
<th width="198"> <div align="center">Phone </div></th>
</tr>
<?
while ($array = mysql_fetch_array($query))
{
?>
<tr>
<td><div align="center"><?=$array["name"];?></div></td>
<td><?=$array["level"];?></td>
<td><?=$array["phone"];?></td>
</tr>
<?
}
?>
</table>
<?
mysql_close();
}
?>