> I can either A) in the header or my page, generate a recordset of all of > the records in the related table and then loop through the recordset > creating an array of the fields I need and then later pull from it in the > repeat region... or B) take the six lines of code Dreamweaver generates to > create a recordset and move them into the repeat region itself. In other > words, I can create a recordset of all of the records in the related > table, > loop through it generating a PHP array and pull from this array later OR I > can query the database every time through the loop while creating the > repeat region. > > Since I haven't freed the table until the bottom of the page and because > my > MySQL Sever and PHP Server reside on the same machine, will I really > notice > a measurable difference in speed? If my MySQL Server were a different > machine, I'm sure that there would be a noticable difference because all > of > the queries would be across a network (possibly the internet) and traffic > would become a factor.
Accessing an array is always faster than looping thru query results from an SQL database. Question though... Your page runs, grabs the data for the array, builds the page, then is done. At that point, your array is gone, and the next page load would loop thru the database and create the array again. This is doing double work. Is this how you're running? Just a page? Just want to clarify. If that's the case, don't worry about the array, just hit the SQL server each time. -Dan Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php