I have a php code with 4 Menus(products,suppliers,purchases,customers). Each menu has its own stored procedure. EACH meanu has these code:
Code for Products:
<?php
$sql=$mysqli->query("call selectproducts()");
$i=1;
while($row=mysqli_fetch_array($sql)){
$id=$row['prodid'];
$date=$row['prodname'];
$item=$row['proddescription'];
$qtyleft=$row['prodsupplier'];
$qty_sold=$row['proddate'];
$price=$row['prodprice'];
$sales=$row['prodquantity'];
if($i%2){
?>
<tr id="<?php echo $id; ?>" class="edit_tr">
<?php } else { ?>
<tr id="<?php echo $id; ?>" bgcolor="#f2f2f2" class="edit_tr">
<?php } ?>
<td class="edit_td"><span class="text"><?php echo $date; ?></span> </td>
<td><span class="text"><?php echo $item; ?></span> </td>
<td><span class="text"><?php echo $qtyleft; ?></span></td>
<td><span id="last_<?php echo $id; ?>" class="text">
<?php
echo $qty_sold;
?>
My problem is whenever I tried to use stored procedure in other menus or even in 1 menu this error in other meanus (suppliers,purchases,customers):
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given
To make it short, If i included just even one(1) stored procedured, the error occurs. The only thing that everything will work is that when i use it in normal way (SELECT * from table).
What could be the problem?please help me..This is the only problem in my project.
Mysql Stored Procedure Code:
CREATE DEFINER=`root`@`localhost` PROCEDURE `selectproducts`()
begin
select * from products order by ProdID;
end
Here's the full code: http://jsfiddle.net/WKKD4/
Sorry I have no other place to put it on.