Hi here is my logic, i haven't tested but it should work (i hope)!!!
i'm not sure if it works only on php5...!?! Let me know if it is a complete
crap i've just started learning php.
Bye
$recordset=mysql_query($query); // whatever query is
$obj_array=new ArrayObject($recordset);
// get the iterator now
$interator=$obj_array->getIterator();
// you can now easly navigate in the recordset by the iterator
/* define an array with n fields to be shown on top of page. Attention
...values name must be the same of table field names you want to show on top
of the page*/
$my_key = array(0=>'key1',1=> 'key2',....,n-1=>'keyn');
// echo the top of the page
$i=0;
while($iterator->valid())
{
if ($iterator->key()==$my_key[$i] )
{
echo "<p>".$iterator->key()." : ".$iterator->current()."</p>";
/* if u need a top_array to store result shown on top of the page,
uncomment this line only
$top_array[$i]=$iterator->current(); // loose the matching
key<->field!! */
$i++;
$iterator->next();
}
else
$iterator->next();
}
/* to display the whole recordset resulting from the query don't forget
you still have
$recordset free to use with mysql_fetch_array() or other way to display */
echo '<p>this is the bottom page and displays the whole result</p>';
while ($res=mysql_fetch_array($recordset))
for each ($res as $k=>$val)
echo "<p>$k : $val</p>"; // make your choice for html code
"Aaron Wolski" <[EMAIL PROTECTED]> ha scritto nel messaggio
news:[EMAIL PROTECTED]
> Hi All,
>
> Got this logic problem I don't know how to solve.
>
> Is there any way I can make a call to the DB for some records.
>
> Display some info from a column or two say at the top of the page and
> then display the full result set in a while() loop?
>
> Right now, I am making two calls to the Db to get the data I need to
> display at the top of the page and then a second query to retrieve the
> full result set.
>
> I'm confused!
>
> Thanks for any help!
>
> Aaron
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php