Re: coding help - displaying the records
| From: | Mukul Sabharwal | Date: | Thu, 26 Oct 2000 08:17:00 +0000 |
| Subject: | Re: coding help - displaying the records | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-22082@lists.php.net to get a copy of this message | ||
while (list($id, $name, $desc) =
mysql_fetch_row($query)) {
$new_query = mysql_query("select id from renegate
where flag = 1 and id = '$catid'"));
if ($x == 0) {
echo "<tr><td><a href=$PHP_SELF?catid=$id>$name</a> -
$desc</td>";
$y = $x = 1;
continue;
}
if ($x == 1) {
$y++;
echo "<td><a href=$PHP_SELF?catid=$id>$name</a></td>";
if ($y > $cols) $x = 2;
continue;
}
if ($x == 2) {
echo "</tr><tr><td><a
href=$PHP_SELF?catid=$id>$name</a></td>";
$x = 1;
}
}
this is the code for doing the column thing.... just
define $cols and you'll be fine... as far as the next
/ prev goes....
if ($offset > 0) {
echo "build prev link here minus offset from limit";
}
if ($offset+$limit >= $result) {
echo "build next link here offset + limit";
}
u can also find. no of pages with mod.. like
$mod = ($result % $offset);
if ($mod == 0) {
echo "pages = result dividied by offset";
} else {
echo "pages (result divided by offset) + 1";
--- Slaven Vujic <slaven@sdnet.hr> wrote: >
> Hello,
>
> I want to display the records in this format:
>
>
http://www.globetrotter.de/de/htm_shop/a_z_liste.php3?word=Abziehstahl
>
> I have trouble with PHP code that displays the data
> in 4 rows (each row has 3 records).
> There is also maximum of 12 records per page.
>
> Anybody willing to offer the example of code?
>
> TIA
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-general-unsubscribe@lists.php.net
> For additional commands, e-mail:
> php-general-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
=====
To Find Out More About Me : http://mukul.tsx.org/
__________________________________________________
Do You Yahoo!?
Yahoo! Messenger - Talk while you surf! It's FREE.
http://im.yahoo.com/