Jump to content

2nd Time Through PHP Loop Has Wrong Data


RockyMtnHi

Recommended Posts

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)."<br />";
          echo "<em>-- Area Codes Supported:</em><br/>";
          echo $areaCodes;
          echo "</div>";
          echo "</div><br />";
       } //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.

 

The Grand Rapids, Kalamazoo, Holland area codes are

616, 269, 616

and their area codes are 49xxx

 

Thanks in advance for the help...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.