stesouthby
New Member
- Messages
- 115
- Reaction score
- 0
- Points
- 0
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/>';
}
?>
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/>';
}
?>