Report printing help

Hi sir.pls help me on this.
this code only showing one customer report on one page.but i want to get all the customer details like wise on one report page.so pls help me on this…

<?php $rview = $_POST['rview']; $q = mysql_query("SELECT cus_name FROM cus WHERE cus_id = '$cus_id'"); $r = mysql_fetch_assoc($q); $cus_name = $r['cus_name']; echo "

Customer: {$cus_name}

"; if($rview == "products"){ ?> <?php $total_qty = 0; $total_gross = 0; $q = mysql_query("SELECT itm_code, itm_des, itm_unit, SUM(ini_qty), SUM(ini_qty * ini_price) AS gross FROM itm, inv, inv_itm WHERE itm_id = ini_itm AND inv_id = ini_trn AND inv_cus = '$cus_id' AND inv_date BETWEEN '$from' AND '$to' GROUP BY ini_itm"); while($r = mysql_fetch_assoc($q)){ $itm_code = $r['itm_code']; $itm_des = $r['itm_des']; $itm_unit = $r['itm_unit']; $itm_qty = $r['SUM(ini_qty)']; $gross_val = $r['gross']; echo "\n"; $total_qty += $itm_qty; $total_gross += $gross_val; } ?>
Code Description Unit
Qty
Gross Value
{$itm_code} {$itm_des} {$itm_unit}
".number_format($itm_qty,2,".",",")."
".number_format($gross_val,2,".",",")."
     
<?php echo number_format($total_qty,2,".",","); ?>
<?php echo number_format($total_gross,2,".",","); ?>
<?php

Your code is obsolete, insecure, and vulnerable to an SQL Injection Attack. You need to re-write it in PDO with prepared statements. Your code will not even work at all in the current version of PHP.

https://phpdelusions.net/pdo

Additionally, you need to get rid of all the inline styles and use a proper CSS file.

I would also suggest stop using tutorials/scripts that you find from the late 90s on the internet. One of my peeves about the internet is that there are a lot of outdated information out there and it usually on websites that aren’t updated very often (if at all). The owner of the website either has forgotten about it or thinks they are doing a service to others by leaving outdated crap on their website(s). Good websites will update their websites often, have dates when tutorials where posted and have notices that this tutorial might be outdated if it has been on the website for a while. I know I have felled victim (especially when I was first starting out) in following a bad tutorial only to have to start all over again. It’s frustrating, but one learns to be more diligent when looking for tutorials on the internet.

Sponsor our Newsletter | Privacy Policy | Terms of Service