I am using a table in which I have different particulars and different quantities for same ID, now I want quantities of each particular separately for that same particular ID to be printed.
$mq="SELECT count( particulars ) AS 'n' FROM delivery_challan WHERE job_order_id =".$_GET['jo'];
$ha=mysqli_query($link,$mq);
$haha=mysqli_fetch_object($ha);
$n=$haha->n;
echo $n;
for($i=1;$i<=$n;$i++)
{
$nq="SELECT qty FROM `delivery_challan` WHERE job_order_id=".$_GET['jo'];
$r=mysqli_query($link,$nq);
//$i=1;
$rs=mysqli_fetch_object($r);
$qty=$rs->qty;
}
This is how I am trying to fetch the respective quantity in $qty variable. This variable is used below :
<td><input name="invqty[]" type="text" onchange="SetDefault(<?php echo $cnt; ?>, $(this).val());" onkeyup="this.onchange();" onpaste="this.onchange();" oninput="this.onchange();" class="form-control1" id="invqty<?php echo $cnt; ?>" size="5" value="<?php echo $qty; ?>"></td>
For example :
In my table 'delivery_challan' I have 3 particulars x, y & z with 3 different quantities 10,20 & 30 respectively. Now in the above mentioned I want all the three quantities to be printed. The is being printed 3 times correctly, but in all 3 's only 10 is printed where as 10 then 20 and in 3rd, 30 must be printed. But only the first value is being printed.
I am not able find a solution. Please help me. Thanks.