Php / Mysql While Loop Error
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in on line 24

Not sure why this is doing this... I tried removing one of the parameters in the while loop that did not seem to do much.


    <style type="text/css">
    table{font-size:1.11em;}
    tr{background-color:#eee; border-top:1px solid #333;}
    </style>
    <?php
    $con = mysql_connect("localhost","root","pass");
    if (!$con)
    {
        die('Could not connect: ' . mysql_error());
    }
    
    mysql_select_db("bookorama", $con);
    
    $sql="SELECT customer.name, books.title, books.isbn, books.price 
    		 FROM customers, orders, order_items, books
    		 WHERE customers.customerID = orders.customerID 
    		 AND orders.orderID = order_items.orderID 
    		 AND order_items.isbn = books.isbn;";
    		  
    $result = mysql_query($sql);     // You actually have to execute the $sql with mysql_query();
    echo "<h1 style='color:#3366ff;'>Each customer book orders</h1>";
    echo "<table>";  //start the table
    
    while($row = mysql_fetch_array($result, MYSQL_ASSOC))  //Loop through the results
    {
        //echo each row of the table
        echo "<tr>";              
        echo "<th><strong>Customer Name:/strong><br></th>";               
        echo "<td>$row[name]</td>";       
        echo "<th><strong>Book Title</strong><br></th>";                
        echo "<td>$row[title]</td>";
        echo "<th><strong>ISBN</strong><br></th>";  
        echo "<td>$row[isbn]</td>";
        echo "<th><strong>Book Price</strong><br></th>";  
        echo "<td>$row[price]</td>";
        echo "</tr>";
    } 
    
    echo '</table>';   //close out the table
    
    ?>

Php / Mysql While Loop Error
===

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in on line 24

Not sure why this is doing this... I tried removing one of the parameters in the while loop that did not seem to do much.


    <style type="text/css">
    table{font-size:1.11em;}
    tr{background-color:#eee; border-top:1px solid #333;}
    </style>
    <?php
    $con = mysql_connect("localhost","root","pass");
    if (!$con)
    {
        die('Could not connect: ' . mysql_error());
    }
    
    mysql_select_db("bookorama", $con);
    
    $sql="SELECT customer.name, books.title, books.isbn, books.price 
    		 FROM customers, orders, order_items, books
    		 WHERE customers.customerID = orders.customerID 
    		 AND orders.orderID = order_items.orderID 
    		 AND order_items.isbn = books.isbn;";
    		  
    $result = mysql_query($sql);     // You actually have to execute the $sql with mysql_query();
    echo "<h1 style='color:#3366ff;'>Each customer book orders</h1>";
    echo "<table>";  //start the table
    
    while($row = mysql_fetch_array($result, MYSQL_ASSOC))  //Loop through the results
    {
        //echo each row of the table
        echo "<tr>";              
        echo "<th><strong>Customer Name:/strong><br></th>";               
        echo "<td>$row[name]</td>";       
        echo "<th><strong>Book Title</strong><br></th>";                
        echo "<td>$row[title]</td>";
        echo "<th><strong>ISBN</strong><br></th>";  
        echo "<td>$row[isbn]</td>";
        echo "<th><strong>Book Price</strong><br></th>";  
        echo "<td>$row[price]</td>";
        echo "</tr>";
    } 
    
    echo '</table>';   //close out the table
    
    ?>
