TABLE bcompany
companyID | cName | ...
I have the input field, where user searches for the records including the "input" characters:
<input type="text" class="bigblack" name="srch" />
PHP:
$req="%".mysql_real_escape_string($_POST['srch'])."%";
$query = mysql_query("SELECT companyID, cName FROM bcompany WHERE
companyID OR cName LIKE $req ORDER BY companyID LIMIT 10");
OR
$query = mysql_query("SELECT companyID, cName FROM bcompany WHERE
companyID,cName LIKE $req ORDER BY companyID LIMIT 10");
Both queries return an error:
mysql_fetch_array() expects parameter 1 to be resource....
There is probably something wrong with the MYSQL SELECT.
Can you please help me solve this out?
Thanks in advance :)
Rest of the code:
while($res = mysql_fetch_array($query)) {
echo $res["companyID"];
echo $res["cName"]."<br>";
}