-1

Possible Duplicate:
PHP: Warning: sort() expects parameter 1 to be array, resource given

Warning: mysql_error() expects parameter 1 to be resource, boolean given in /var/www/html/stockm/include/include.php on line 26

Transaction Fail :

select p.ProductID as product_id, p.ProductName as product_name,c.categoryname as product_catgegory, p.ProductDescription as product_desc,p.saleprice as product_price,p.Discontinued as product_dis from sm_products p inner join sm_category c on p.CategoryID=c.categoryid inner join sm_stockin si on si.productid=p.ProductID where (p.datedel='' or p.datedel is null) and p.active=1

Error Detials

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /var/www/html/stockm/include/include.php on line 100

code:

$stmt = mysql_query($SQLStr); 
if(!$stmt) 
{ 
     echo "Transaction Fail : <br/>" . mysql_error($stmt) . "<br/>" . $SQLStr ; 
}
$row = mysql_fetch_array($stmt,MYSQL_BOTH); 
Community
  • 1
  • 1
Hero Oo
  • 30
  • 1
  • 8

1 Answers1

0

mysql_error should be given the MySQL connection, if not specified, the last link opened by mysql_connect() is assumed. Simply you can call it without parameter. And if error happened, you should exit your script.

$stmt = mysql_query($SQLStr); 
if(!$stmt) 
{ 
     die "Transaction Fail : <br/>" . mysql_error() . "<br/>" . $SQLStr ; 
}
$row = mysql_fetch_array($stmt,MYSQL_BOTH); 
xdazz
  • 154,648
  • 35
  • 237
  • 264