Hello, I'm new to this group and already have a problem (actually the problem is the reason I found the group). I'm taking a Fundamentals of Programming class, and they are using PHP to get the message across. I'm having a lot of trouble passing the values in the first array to the second array. I included the code (below). If anyone would be so kind as to give me some advice (I'm NOT looking for someone to write it for me, just some helpful advice). The data is being read in correctly (for the first array anyway). The first function works wonderfully, the second function is supposed to handle customer inqueries, working from the $code/$cust_code variables. I need to match the numbers in these two arrays, and use switch on $cust_area to let it know what to print.
Thanks Tony +++++++++++++++++ <html> <head> </head> <body> <pre> <?php $fp1=fopen("proj10b.dat","r"); $fp2=fopen("proj10b2.dat","r"); $date=date("m-d-Y"); headers($date); main($fp1,&$name,&$code); inquiry($fp2,$date,$name,&$code); fclose($fp1); fclose($fp2); function headers($date) { print"DENTAL FEES BY REGION as of Date: $date<br>"; print" Printed by: Tony Hall<br>"; print" <br>"; print" National New<br>"; print"Code - Procedure Median England Midwest Pacific<br>"; print" <br>"; return; } function main($fp1,$name,&$code) { for($index=0;$index<43;$index++) { $name[$index]=(string)fgets($fp1,42); $code[$index]=(string)fgets($fp1,6); $nat_cost[$index][1]=(integer)fgets($fp1,4); $east_cost[$index][2]=(integer)fgets($fp1,4); $mid_cost[$index][3]=(integer)fgets($fp1,4); $pac_cost[$index][4]=(integer)fgets($fp1,4); printf("%1s - %10s %10s %10s %10s %10s", $code[$index], $name[$index], $nat_cost[$index][1], $east_cost[$index][2], $mid_cost[$index][3], $pac_cost[$index][4]); print" <br>"; } return; } function inquiry($fp2,$date,$name,$code) { while(!feof($fp2)) $cust_name=trim(fgets($fp2,12)); $cust_area=trim(fgets($fp2,9)); $cust_code=trim(fgets($fp2,6)); if($cust_code==$code[$index]) { $row=$index; } switch($cust_area) { case "National": print "national<br>"; printf("%1s %1f", $name[$row], $cust_cost[$row][1]); break; case "East": print"East<br>"; printf("%1s %1f", $name[$row], $cust_cost[$row][2]); break; case "Midwest": print"midwest<br>"; printf("%1s %1f", $name[$row], $cust_cost[$row][3]); break; case "Pacific": print"pacific<br>"; printf("%1s %1f", $name[$row], $cust_cost[$row][4]); break; } return; } ?> </pre> </body> </html> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php