...

View Full Version : Eof bof



SlayerACC
12-09-2010, 04:09 AM
How can you determine the EOF or BOF of your database.?

I am looking to do something such as when it reaches the end of the database that it will move previous.. and when you reach the BOF of the database how can you make it move next.??

Thanks, S.

firepages
12-09-2010, 11:59 AM
are you talking about a flatfile database ?? if so BOF is the first line ;)
eof can be grabbed by feof (http://php.net/manual/en/function.feof.php)

e.g.
while(!feof($stream)){ ... etc

SlayerACC
12-09-2010, 12:41 PM
firepages

sorry .. the database is mysql

Thanks, S.

firepages
12-09-2010, 02:17 PM
you would have to find the maximum and minimum values of the primary key ...



$sql="SELECT MAX(`$id_field`) as max, MIN(`$id_field`) as min FROM `$table` WHERE $where_conditions";

SlayerACC
12-09-2010, 06:02 PM
I will give this a try.. and let ya know of the progress.

Thanks for your help..

S.

SlayerACC
12-09-2010, 06:19 PM
How can I show the results to the sql statement..??

Thanks, S

firepages
12-10-2010, 12:38 AM
obviously I don't know what $id_field and $table are.


$sql="SELECT MAX(`$id_field`) as eof, MIN(`$id_field`) as bof FROM `$table` ";
$r=mysql_query($sql);
$array=mysql_fetch_assoc($r);
echo $array['bof'];
echo $array['eof'];



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum