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
做它表明這個錯誤 –
未知列 '' 中',其中$搜索條款' –