Reply to Re: newbie: page state with php?

Your name:

Reply:


Posted by Lucman on 06/11/06 05:39

deko wrote:
> I'm trying to create a site that pages through data retrieved from a database.
>
> Let's say there are 12 items, and only 3 at a time can be displayed on a single
> web page.
>
> So the user needs to see some king of navigation control (a simple link would
> suffice) that tells him there X items ahead and Y items behind. This way he can
> page through all 12 items, 3 at a time, moving forward and backward.
>
> Does this require some king of page/session state? How will my code know if
> items 1 through 3 or 6 through 9 are currently displayed?
>
> My guess is I'm not the first one who has needed to solve this kind of problem.
>
> Can anyone point me in the right direction? Code examples would be great...
>
> Thanks in advance.

On your query:
Try using LIMT on SELECT statement.

For Example
<?php
function showitems($start,$limit)
{
.......
$end = $start + $limit;
//Set your query like this for example.
$query = "SELECT * FROM items LIMIT "."$start"." , "."$end";
.....
//execute query
//display your HTML result;
}
?>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация