I am really very thankful to all of you for helping me in my first project.
I have successfully developed few scripts for my project. Now i am trying to code a script to pull out results from MySql, but i can’t figure out how to do it. Database structure is
Table ‘ledger’ has two fields named ‘insurers’ & ‘issuing_office’. ‘Insurers’ & ‘Issuing_office’ values are populated from Database to Dropdown & then the values are inserted in ledger table.
Now I am trying to code a loop to select values from ledger table for each ‘insurer’ & ‘issuing_office’ where ‘received_fees’ = 0. The Query is like this.
SELECT bill_no, bill_date, insured_name FROM ledger WHERE insurers=" $insurers " AND issuing_office=" $issuing_office " AND received_fees="0" ;
Insurers table has 12 rows & Issuing_office has 38 rows.
I wana loop through all insurers & all issuing offices where received_fees is Zero.
Now the company NIC1 has 5 office in five different cities (City1, City2 etc)
Company NIAC has 10 office (City1, City2, City30 etc). Insurers & issuing_office fields has repeating company name & office.
A web form is created. In this form there are two dropdowns. Both dropdowns are populated from database table Insurers (with 12options) & issuing_office (with 32 options) & then the values are inserted into ‘ledger’ table in relevant fields (insurer & issuing_office).
First i wana generate list of company NIC & city1 where received_fees=0
& then company NIC & city2 & so on for each company & respective office.
at this point have stored Insurers & Issuing_Office values into two different arrays like this
$query = "SELECT insurers FROM insurers";
$result = mysql_query($query);
if (!$result)
{
die ("Could not query the database: <br />". mysql_error( ));
}
while ($row = mysql_fetch_assoc($result))
{
$insurers[] = $row['insurers'] ;
}
print_r($insurers);
echo '<br /><br /><br /><br />';
$queryI = "SELECT issuing_office FROM issuing_office";
$resultI = mysql_query($queryI);
if (!$resultI)
{
die ("Could not query the database: <br />". mysql_error( ));
}
while ($row = mysql_fetch_assoc($resultI))
{
$issuing_office[] = $row['issuing_office'] ;
}
print_r($issuing_office);
First I wana select NIC & City1 & then show fields where received_fees_=0 & then
NIC & City2 & the show fields.
I can’t figure out how to loop this query. May be it is possible with loop inside loop.
Please friends help me. I am working on this script from the last 2 days.