search query help
hey guys am doing a simple mysql query but keep gettingan error with this part of the php file
while ($row = mysql_fetch_array($sql)){
and this is the error i get i cant work out why wonder if you knew any better?
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in ///l/search.php on line 9
<?php
mysql_connect ("localhost", "","") or die (mysql_error());
mysql_select_db ("");
$company_name = $_POST['company_name'];
$sql = mysql_query("select * from customertable where company_name like '%$company_name%'");
while ($row = mysql_fetch_array($sql)){
echo 'ID: '.$row['customer_ID'];
echo '<br/> First Name: '.$row['company_name'];
echo '<br/> Last Name: '.$row['customer_name'];
echo '<br/> Phone: '.$row['email'];
echo '<br/><br/>';
}
?>
"It's time to prove to your friends that you're worth a damn. Sometimes that means dying, sometimes it means killing a whole lot of people."- sin city "You either die a hero or you live long enough to see yourself become the villain" - TDK