I need to pass two values thru hyperlink.Like i am listing quotes for an author,I have page limit of 20 and books are 30.I have displayed first 20 using the code below. Then I want to pass the author name and the page number so that when call returns to same page, the list from 21 to 30 will be displayed. Please let me know if we can pass two values thru hyperlink( I have made it bold in the code below) and also receive two values...
OR can somebody please tell me another way of doing this...
<?php
/ Connecting, selecting database /
...........
/ getting the author name for the first time /
$sort = $GET['by'];
// get the total number of records
$page =1;
/ getting the page number for paging /
$page = $GET['page'];
/ if page number is spaces as for the first time the page number is not populated, populating 1 /
if ($page < 1) {
$page = 1;
}
$limit = 10;
/ Performing SQL query to get the total number of quotes /
$result = mysql_query("select count() from Quotes");
$num = mysql_result($result, 0, 0);
$total = ceil($num / $limit);
$offset = ((($page-1) $limit) + 1) ;
/ Performing SQL query to get the quotes /
$query = "SELECT DISTINCT Quote FROM Quotes WHERE Author =\"$sort\" LIMIT $offset, $limit ";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
/ Printing results in HTML /
$x=1;
<tr><font color="#800000">
<?php
/ display previous /
if ($page ==1) {
echo "<font face=arial size=-40>Previous";
}
else {
echo "<a href=\"temp3.php?page=" . ($page - 1)."\"><font face=arial size=-40>Previous</a>";
}
/ display panel /
for ($i = 1; $i <= $total; $i++) {
echo " | ";
if ($i == $page)
echo "Page $i";
else
echo "<a href=\"temp3.php?page=$i\">Page $i</a>";
}
echo " | ";
/ display next /
if ($page == $total) {
echo "<font face=arial size=-40>Next";
}
else {
echo "<a href=\"temp3.php?page=" . ($page - 1) . "\"><font face=arial size=-40>Next</a>";
}
?>
</font></tr>
<?php
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
if (($x % 2) == 0) {
?>
<TR><td bgcolor="#C8DBDF">
<?php
}
else {
?>
<TR><td bgcolor="#CCCCCC">
<?php
}
echo "<font face=arial size=-1>".$line['Quote']."";
?>
</td></TR>
<?php
$x++;
if ($x==20){
$page++;
}
}