Forum Moderators: coopster

Message Too Old, No Replies

Pagination W/ Script

I can't figure out how to make pagination work with my current script.

         

silentex

9:03 pm on Apr 25, 2006 (gmt 0)



I hate to resort to posting on a forum, especially being so desperate, however I've looked at virtually every tutorial on P2L, Google, and anywhere else I could be sent to, and I cannot get pagination to work. I'm making a simple little website for my boss who owns a furniture store and I want the search results (or, in the code that I'm showing, basic query for furniture). Virtually he wants certain items displayed that are on sale, at-risk, or he just wants to get rid of. So, there is a table that is set as "0" for being on sale, and those are the ones displayed on the site. There are around 200 items and I can't get them displayed correctly with pages.

Any help would be greatly appreciated! And thank you in advance!


<?php

mysql_connect("localhost","none","noname");
mysql_select_db("none");

$sale = "0";

$result = mysql_query("SELECT * FROM bedroom WHERE item_sale LIKE '%$sale%'");
$t = "0";
if(mysql_num_rows($result) > 0) {
while($r=mysql_fetch_array($result)) {
$item_number=$r["item_number"];
$item_mfg=$r["item_mfg"];
$item_type=$r["item_type"];
$item_series=$r["item_series"];
$item_pic=$r["item_pic"];
$item_thumb=$r["item_thumb"];
$item_desc=$r["item_desc"];
$items_list=$r["items_list"];

if ( ( browser_detection( 'browser' ) == 'ie' )
&&
( browser_detection( 'number' ) >= 5 ) )
{
if ($t < 3)
{
if ($t=="2")
{
echo "<a href=detail.php?p=$item_number&table=bedroom><img src=$item_thumb border=0></a><br/>";
$t="0";
}
else
{
echo "<a href=detail.php?p=$item_number&table=bedroom><img src=$item_thumb border=0></a>";
$t++;
}
}
}
else
{
echo "<a href=detail.php?p=$item_number&table=bedroom><img src=$item_thumb border=0></a>";
}
}
}
?>

Thank you very much!

eelixduppy

10:30 pm on Apr 25, 2006 (gmt 0)



Hello...

I don't understand why you have chosen to make $t a string considering you are doing integer math with it. I suggest making $t = 0; instead of $t = "0"; Then when you compare it to other values use $t==2 instead of $t=="2".

See how this turns out...

eelix