Hi, I built a block of code that uses several concatenated queries,then prints the output, manipulates it, and prints out percentages, all in an HTML table. The queries are based on user inputs of Month ($mo), Year($y) and Salesperson ($sp) and works OK as long as the user selects a salesperson.
The problem is when the user selects "ALL SALESPEOPLE" which doesn't generate a "WHERE salesperson = $sp" clause in the query. I get a row which list all the salespeople ACROSS, then the data which is totals of ALL salespeople.
What I need is for "ALL SALESPEOPLE" to generate a table where each row shows ONE salesperson and their data, then the next row shows the NEXT salesperson and their data. Is there something I could add to the query, or before the query, that says
"if $sp = 00, then run this whole block of code for each salesperson until all salespeople have been ran? "
I think that would make the table look the way I want it to, but I don't know how to set this up.