p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Beginning PHP (http://p2p.wrox.com/forumdisplay.php?f=95)
-   -   Multiple pages (http://p2p.wrox.com/showthread.php?t=21674)

usedcarsgbcom November 24th, 2004 08:14 AM

Multiple pages
 
Hi Matt
Thanks for your help, I have successfully joined my tables! The error came from putting the LIMIT in single quotes rather than Double.

One further question if you dont mind:

I have used the following code

$start = $_GET['start'];
$end = 4 + $start;
$Query = "SELECT * FROM VehicleStock LEFT JOIN cpg11d_pictures ON VehicleStock.RegNo = cpg11d_pictures.title LIMIT $start,$end";

to LIMIT the number of pictures per page, starting the page as Display.php?start=0

The problem I have is that the 1st page is fine with 4 pictures, however page 2 now has 7 pictures and not 4, with page 3 having 3 pictures. This gives a total of 14 pictures when I only started with 11 !!!! How can I restrict each page to just 4 pictures?

website page should it help is:

http://www.usedcars.gb.com/Display.php?start=0

I really am appreciating your assitance

Regards

Bruce



mani_he November 24th, 2004 12:31 PM

hi usedcarsgbcom
As I can see you want to put the limit for outputing mysql result so check this code. maybe it shoud work for you:
$page = $_GET['page'];
$limit = 5;
$start = ($page - 1) * $limit;
$query = mysql_query("SELECT * FROM table WHERE LIMIT $start, $limit");

Regards
Mani_he



All times are GMT -4. The time now is 10:36 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.