Skip to content
Advertisement

How to change and set the loop for the following code to display “Purpose & Stamp” only?

My code can print only separate invoice for each different product and I coded it for single product only but I need to add multiple product print in single paper. I am facing syntax error to change the loop body.How can I shift down the loop between “Purpose & Stamp” under the table?

here is the code so far

JavaScript

Advertisement

Answer

Preamble

It is quite unclear for me what you mean with shifting the loop down. What I suppose you want to achieve is to loop the lower section, not everything. This answer is based on that assumption. So here is my guess, cleaning up your code a little bit making use of PHPs templating power what makes it much easier to read.

Explanation

I am fetching the first row, using that data for the first elements. Where the loop occurs I’ve put the string %s as a placeholder and fill it later with the real content. For the loop itself, a do while is perfect, because on the first run $row stays what it is and the while runs until out of data.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement