PDA

View Full Version : Reset Array Pointer in DB Class?


Jaxel
05-13-2010, 04:13 PM
$services = $vbulletin->db->query_read("SELECT * FROM " . TABLE_PREFIX . "media_service");

while ($service = $vbulletin->db->fetch_array($services))
{
if ($match) { break; }
}

Okay, lets say I have the code above. It gets a list of services, checks to see if the service matches; if the service matches, it breaks the loop and continues on with the current service data. The problem is that I need to run this while loop about 1000 times. Normally if I iterate this, the while loop will continue on from the last place it left off. However, I need the while loop to continue to the beginning of the $services array every time it gets iterated.

So what I want to know, is if there is a way to reset the pointer of fetch_array to the beginning of the loop. In PHP I know I can do something like "reset($services);", could I do that here?