Warning: Trying to access array offset on value of type bool in /var/www/vhosts/tomelliott.com/httpdocs/wp-content/themes/tomelliott/single.php on line 12

Reset PHP Recordset for Multiple Repeat Regions

07 January, 2012 by Tom Elliott

Occasionally in your PHP application, you may need to have multiple repeat regions on one page using the same recordset. If you don’t reset the recordset after the first time you use a repeat region, the content in the second repeat region will appear blank.

For example, if the first repeat region looks something like the below (it probably will if you have added it using DreamWeaver):


 [HTML code block that is being repeated]

Then you can add the following code to reset the recordset pointer and select the first row. If you don’t select the first row of the recordset after resetting it, then you will probably get a blank line in your second or next repeat region.


    [HTML code block that is being repeated]

 



2 Comments

  • Ivars says:

    Perfect…had headache about this all morning 🙂 now it’s sorted..thank you

  • MAD says:

    I had a headache for 2 hours and now it is fine. Thank you!