954,580 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

2nd Time Through PHP Loop Has Wrong Data

I have a loop that writes out data for franchises. It works the first time through, but not the 2nd. Here is the page where the data is written out:
http://184.172.137.97/~royl21st/1.php

Here is the code that spits out the wrong data after the first successful loop. Any ideas?

$areaCodeData = getData($sSql, $con, $dbName);
       $areaCodeRowCount = mySQL_num_rows($areaCodeData);
       $areaCodeRowCur = mysql_fetch_assoc($areaCodeData);
       if ($areaCodeRowCount != 0) {
          echo "<div class='box left'>";
          // list all Area Codes for this Franchise
          echo "<div class='details'>";
          $areaCodes = "";
          for ( $ctrAreaCode = 0; $ctrAreaCode <= $areaCodeRowCount - 1; $ctrAreaCode += 1) {
             // grab AreaCodes
             $areaCodes = "<b>".$areaCodes.$areaCodeRowCur['AreaCode']."</b>, ";      
             // fetch next AreaCode row
             $areaCodeRowCur = mysql_fetch_assoc($areaCodeData);
          } // end ctrAreaCode for loop
          $areaCodes = substr($areaCodes, 0, strlen($areaCodes)-2)."";
          echo "<em>-- Area Codes Supported:</em><br/>";
          echo $areaCodes;
          echo "</div>";
          echo "</div>";
       } //end Area Code loop
       
       // reset AreaCode loop pointers (is this a PHP bug?)
       mysql_data_seek($areaCodeData,0);


At this point I'm desperate and I have to get this working ASAP.

Thanks in advance for the help...

RockyMtnHi
Newbie Poster
3 posts since Apr 2011
Reputation Points: 10
Solved Threads: 0
 

Can you please explain what is wrong with your output (or what you want changed).

pritaeas
Posting Expert
Moderator
5,483 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

Grand Rapids, Kalamazoo, Holland area codes are
616, 269, 616
and their area codes are 49xxx

RockyMtnHi
Newbie Poster
3 posts since Apr 2011
Reputation Points: 10
Solved Threads: 0
 

Are you sure your query is correct ?

pritaeas
Posting Expert
Moderator
5,483 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: