Solved

PHP: Multiple Repeat Regions from 1 Recordset

Posted on 2009-04-06
2
669 Views
Last Modified: 2013-12-12
I have a simple recordset that simply lists Record ID's and Record Names.

I want to repeat the same rows from the query in 2 or more separate places on the page.

However, if you try to initiate a second Repeat Region, an error is returned as the Recordset has looped through to the last record due to the first Repeat Region.

In ASP i can Requery the original Recordset so the database cursor is reset to the first record again. Maybe not the best practice, but it worked.

What is the best practice to over come this problem in PHP other than having 1 Recordset per Repeat Region?

Thanks
 
0
Comment
Question by:ticallian
2 Comments
 
LVL 48

Accepted Solution

by:
hernst42 earned 500 total points
ID: 24075240
Have you looked at http://www.php.net/manual/en/function.mysql-data-seek.php So the second time you want to process the record set use
mysql_data_seek($result, 0);
and then restart you fetches.
0
 

Author Closing Comment

by:ticallian
ID: 31566928
Thanks.
I had already tried that but must have had a typo as it failed.
Tried again and it worked fine.
 
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question