nested repeat
Hi Jason,
I have managed at last to get the recordset in the right place and the page is starting to come together. I am having trouble with the relationship though.
When our customers decide how many invoices they need to print up to 50 in some cases, they can mark the invoices they wish to print by putting a tick in a box. When these details are ready to be printed the recordset is searched by looking for the boolean tick which is a value of 1. The requested records are then displayed in invoiceid order. Recordset code below...
SELECT *, DATE_FORMAT(datecreated,'%d %M %Y') as printdate
FROM invoice
LEFT JOIN customers ON customers.customerid = invoice.customerid
LEFT JOIN products ON products.invoiceid = invoice.invoiceid
LEFT JOIN preferences ON customers.prefid = preferences.prefid
WHERE invoice.print = '1'
GROUP BY invoice.invoiceid
the nested loop
The second recordset should search for the actual products that should be associated with the relevant invoice, but I am not sure how to link them as the first recordset is using the boolean value as the search criteria. And if I do use that value, it simply displays all the products on every invoice. Recordset code below...
SELECT *
FROM products left join invoice on invoice.invoiceid = products.invoiceid
WHERE invoice.print = '1'
ORDER BY productid
I fully realise that I should use the primary key to link the two repeat regions but I cannot see how I can manage this. Is there another method that I could use?
Any help would be really appreciated
john