I'm getting Resource id #5 as the result when I echo $netprofit .. Here's my code. Just learning php so I'm not the savviest yet.

<?php
$netprofit = mysql_query ("SELECT c.*
FROM jem_invoice_payments a
LEFT JOIN jem_invoice_products b ON a.invoice_id=b.invoice_id
LEFT JOIN jem_products c ON b.product_id=c.product_id
WHERE
a.payment_date >= $altstartdate AND a.payment_date <= $altenddate");
?>

    mysql_query simply sends the query to the database and receives the result as a resource object. Your next step would be to do this:

    while($rows = mysql_fetch_assoc($netprofit)){
            echo $rows['row1'] . $rows['row2'] . $rows['row3']...... ect...
    }

    where as the key of $rows is the col name.. IE: $rows['id']

    you can learn more about it at http://us.php.net/manual/en/book.mysql.php

      Write a Reply...