here is an example.
<?php
$database_db = 'bookmarks';
include_once('database_class.egn');
$HOW_MANY = 10;
if (!isset($pos))
$pos = 0;
$pos_prev = $pos - $HOW_MANY;
$pos_next = $pos + $HOW_MANY;
$product_count = $database->count('site', '');
$result = $database->select_array('', 'site', "LIMIT $pos, $HOW_MANY");
foreach($result as $pos => $val)
echo $val['site_address'] ."<br>\n";
if ($pos_prev >= 0)
echo "
<a href='$PHP_SELF?pos=$pos_prev'>Back</a>
";
echo "
<a href='$PHP_SELF?pos=0'>Home</a>
";
if ( $pos_next < $product_count )
echo "
<a href='$PHP_SELF?pos=$pos_next'>Next</a>
";
?>
compare your position to how many fields are in the db.
SELECT count(*) FROM site ;
--
Chris Lee
Mediawaveonline.com
ph. 250.377.1095
ph. 250.376.2690
fx. 250.554.1120
[EMAIL PROTECTED]
""george"" <[EMAIL PROTECTED]> wrote in message
98b7n0$mfc$[EMAIL PROTECTED]">news:98b7n0$mfc$[EMAIL PROTECTED]...
First of all thanks to everyone who has helped me from this ng
but I am afraid I have another question
I am using the code below to pull FAQ out of a database but how do I stop
the next link appearing when the last question is displayed
TIA
george
if ( !isset( $start )){
$start = 0;
}
$num_q = 4;
$sql =" SELECT DISTINCT * FROM $table_name LIMIT $start, $num_q";
$start += 4;
$newStart = $start - $num_q;
$result = @mysql_query($sql, $connection) or die ("Couldnt execute query");
while ($row = mysql_fetch_array($result)) {
echo
"<tr><td class=\"headline\">$row[headline]</td></tr><tr><td align=left
class=\"answer\">$row[answer]</td
></tr>";
}
echo "</table>";
?></td>
</tr>
<tr>
<td colspan="2"><a href="<? print "$PHP_SELF?newstart=$start? -
$num_q" ; ?>">Previous</a>
<a href="<? print "$PHP_SELF?start=$start";
?>">Next</a></td>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]