0

While coding for an e-commerce website. I received warning about this: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\shopping\store\index.php on line 194

This is my code:

<?php
include "connect.php";
            $result1= mysql_query("SELECT * FROM internet_shop");
            while($row=mysql_fetch_assoc($result1))
            {
                echo '       <a rel="facebox" href="orderpage.php?id='.$row['id'].'&transnum='.$transnum.'
                "><img src="img/products/'.$row['img'].'" alt="'.htmlspecialchars($row['name']).'
                " width="109" height="109" class="pngfix" title="Name: '.$row['name'].' | Price: ₦'.$row['price'].' | Description: '.$row['description'].'"/></a>';
            }

            ?>
        </div>
        <div id="orderlist">
            <table width="100%" border="1" cellpadding="2" cellspacing="2">
                <tr>
                  <td></td>
                  <td width="25"><div align="center"><strong>Qty</strong></div></td>
                  <td width="150"><div align="left"><strong>Name</strong></div></td>
                  <td width="25"><div align="center"><strong>Total<br> <?php echo $currency ?></strong></div></td>
                </tr>
                <?php
                $result3 = mysql_query("SELECT * FROM orders WHERE confirmation='$transnum'");
                    while($row3 = mysql_fetch_array($result3))
                        {
                        echo '<tr>';
                        echo '<td><a href="deleteorder.php?id='.$row3['id'].'" id="'.$row3['id'].'" class="delbutton" title="Click To Delete"><img src="img/delete.png"></a></td>';
                        echo '<td><div align="center">'.$row3['qty'].'</div></td>';
                        echo '<td>'.$row3['product'].'</td>';
                        echo '<td><div align="center">'.$row3['total'].'</div></td>';
                        echo '</tr>';
                        }
                ?>
                <tr>
                  <td colspan="3"><div align="right"><span style="color:#B80000; font-size:13px; font-weight:bold; font-family:Arial, Helvetica, sans-serif;">Grand Total: <?php echo $currency ?></span></div></td>
                  <td><div align="center">
                  <?php
                  $result5 = mysql_query("SELECT sum(total) FROM orders WHERE confirmation='$transnum'");
                    while($row5 = mysql_fetch_array($result5))
                      { 
                        echo $row5['sum(total)']; 
                        $sfdddsdsd=$row5['sum(total)'];
                      }
                  ?>


                  </div>
                  </td>
                </tr>
            </table>
            <form method="post" action="personalinfo.php" name="form1" onsubmit="return validateForm()">
            <input type="hidden" name="transnumber" value="<?php echo $transnum ?>" />
            <input type="hidden" name="total" value="<?php echo $sfdddsdsd ?>" />
            <input type="hidden" name="totalqty" value="
            <?php
                  $result5 = mysql_query("SELECT sum(qty) FROM orders WHERE confirmation='$transnum'");
                    while($row5 = mysql_fetch_array($result5))
                      { 
                        echo $row5['sum(qty)']; 
                      }
                  ?>
2
Contributors
1
Reply
9
Views
3 Years
Discussion Span
Last Post by hericles
0

Is this the correct section of code? Your error says line 194 and we can't see that here. The mysql_fetch_array calls you have here look OK, you're passing in a result object each time, the number 1 cause of that error is not doig that correctly.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.