Hello, Sir
i want to loop mysql records until amount has not null
here i am want to adjust my amount ONE by ONE by participial FIELD ID and Amount
i have already tried, while loop is not working
just tell me what should i do where i have right “Now Go To up ($one)”
and “come here ($one)”
send the right query with my php script would be appreciated
thank you
[CODE]<?
$amount = $_REQUEST[‘amount’];
// come here ($one);
qry=mysql_query(“select * from invoice where cl_id='”.$_REQUEST[‘search_text’].”‘ order by balance ASC “);
$data=mysql_fetch_array($qry);
$inv=$data[‘balance’]; $id=$data[‘id’];
if($amount == “0”) { echo “Thank You. Your amount has been Adjusted Succfully”; exit; }
//—————————————————————————————-
if($amount > $inv) {
$c=$amount-$inv;
$sql=mysql_query(“insert into recive (cl_id,amount,id)
values(‘”.$_REQUEST[‘search_text’].”‘,’$c’,’$id’)”);
$amount= $c;
// Now Go To up ($one) loop record untill amount ==”0″ also $amount value will change $amount= $c; then go ($one)
exit; }
//—————————————————————————————-
if($amount == $inv) {
$c=$amount-$inv;
$sql=mysql_query(“insert into recive (cl_id,amount,id)
values(‘”.$_REQUEST[‘search_text’].”‘,’$c’,’$id’)”);
$amount= $c;
// Now Go To up ($one) loop record untill amount ==”0″ also $amount value will change $amount= $c; then go ($one)
exit; }
//—————————————————————————————-
if($inv > $amount) {
$c=$inv-$amount;
$sql=mysql_query(“insert into recive (cl_id,amount,id)
values(‘”.$_REQUEST[‘search_text’].”‘,’$c’,’$id’)”);
echo “Thank You. Your amount has been Adjusted Succfully”;
// dont loop this record
exit; }
?>