我会在我可以在我的数据库中搜索的地方
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in
require_once ('.. / config.php');
$ conn = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) or die (mysql_error ());
mysql_select_db ("DB_DATABASE", $ conn);
$ search = $ _POST ['search'];
$ sql = mysql_query ("select * from opi where model numbers like '% $ search%' or name like '% $ search%'", $ conn);
while ($ row = mysql_fetch_array ($ sql))**strong text**
{
echo "<tr>";
echo "<td width='60px' height='10px' valign='top' align='left' class='borderdb'>". $ row ['number']. "</ td>";
echo "</ tr>";
}
答案 0 :(得分:1)
<?php
$conn = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) or die (mysql_error ());
mysql_select_db ("DB_DATABASE", $conn);
$search = $_POST ['search'];
$sql = mysql_query ("select * from opi where `model numbers` like '%$search%' or `name` like '%$search%'" ,$conn);
while ($row = mysql_fetch_array ($sql))
{
echo "<tr>";
echo "<td width='60px' height='10px' valign='top' align='left' class='borderdb'>". $row ['number']. "</ td>";
echo "</ tr>";
}
?>