0
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("corporate_personnel_order_for_2016") or die(mysql_error());
$search = $_GET['search'];
$result = mysql_query("SELECT * FROM obs WHERE OBS_NUMBER LIKE $search;") or die(mysql_error());
echo "<table><tr><th width=250>OBS Number</th><th width=250>Name</th><th width=250>Purpose</th><th width=250>Date of OB</th><th width=250>Destination</th></tr>";
while ($row = mysql_fetch_array($result)) {
echo '<table><tr>';
echo '<td width=250>' . $row['OBS_NUMBER'] . '</td>';
echo '<td width=250>' . $row['NAME'] . '</td>';
echo '<td width=250>' . $row['PURPOSE'] . '</td>';
echo '<td width=250>' . $row['DATE_OF_OB'] . '</td>';
echo '<td width=250>' . $row['DESTINATION'] . '</td>';
echo '</tr>';
echo "</table>";
当我搜索一个字母和数字的条目它不能显示一个错误,但是当我搜索一个数字只显示在我的表?当我搜索带有数字的字母显示错误?
'LIKE '$ search''尝试用单引号 – roullie
做它表明这个错误 –
未知列 '' 中',其中$搜索条款' –