phpretard Posted December 2, 2008 Share Posted December 2, 2008 I am trying to count the number of emails in the array and display a number. $Match should = 3 $Match is only correct in the first table. The second and third adds 3 to each /******* THIS IS THE ARRAY I AM TRYING TO COUNT*******/ Array ( [0] => [email protected] [1] => [email protected] [2] => [email protected] ) /******* $APPEmail[]=THE ARRAY ABOVE*******/ $result = mysql_query("SELECT * FROM table1 WHERE confirmed2='0' "); while($row = mysql_fetch_array($result)) { $resultSearchAP = mysql_query("SELECT * FROM table2 WHERE APZIPList LIKE '%$PropertyZip%' AND $L1='checked' "); while($row = mysql_fetch_array($resultSearchAP)) { $PoolID=$row['PoolID']; $APPEmail[]=$row['APEmail']; $Match=count($APPEmail); } echo " <table border=0 width='500'> <form action='' method=post> <tr> <td width='130'>Order Number:</td> <td>$ASORDERNUMBER</td> </tr> <tr> <td width='130'>Lender Name:</td> <td>$SendersFirstName $SendersLastName</td> </tr> <tr> <td width='130'>Lender Phone:</td> <td>$lenderPhone</td> </tr> <tr> <td width='130'>Lender Email:</td> <td>$CLEmail</td> </tr> <tr> <td width='130'>Property Zip:</td> <td>$PropertyZip</td> </tr> <tr> <td width='130'>Appraiser Match:</td> <td>$Match</td> </tr> <tr> <td width='130'><input type='hidden' name=ASORDERNUMBER value='$ASORDERNUMBER'</td> <td><input type=submit name='ApproveOrder' value='Confirm And Send'></td> </tr> </form> </table> <br><br> "; } // END SEARCHAP WHILE } // END RESULT WHILE Thank you for looking. Link to comment https://forums.phpfreaks.com/topic/135250-solved-countproblem/ Share on other sites More sharing options...
DeanWhitehouse Posted December 2, 2008 Share Posted December 2, 2008 In the second loop try changing row to rows or do this to the first one. Link to comment https://forums.phpfreaks.com/topic/135250-solved-countproblem/#findComment-704462 Share on other sites More sharing options...
DarkWater Posted December 2, 2008 Share Posted December 2, 2008 Yeah, definitely don't use the same variable...Also, just use mysql_num_rows() instead of count(). Link to comment https://forums.phpfreaks.com/topic/135250-solved-countproblem/#findComment-704467 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.