fazzfarrell Posted January 19, 2007 Share Posted January 19, 2007 Can any one point me in the right direction.I have a database with 300 products with 6 sections, so product numbers 1-100 belong to Dogs, 101-150 belong to cats etc.I have set up a link on a page that will go to the next record in that section, and it also displays the amount of records in that section.What I want to do is have it saying record 1 of 100, when you click on the link it will then be record 2 of 100 etc.I can display the record ID, but of course on the second section it will dis play record 101 0f 49Any one help?! Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted January 19, 2007 Share Posted January 19, 2007 [code]http://www.phpfreaks.com/tutorials/43/0.php[/code] Quote Link to comment Share on other sites More sharing options...
fazzfarrell Posted January 19, 2007 Author Share Posted January 19, 2007 Did nt quite get this, but noe I have added this[code]<?php if($_GET['ID']) { $page = $_GET['ID']; }else{ $page = 1; }?>[/code]This gets the page number from the ID, I am at the moment trying to change it so if the ID no is > 1 numbering will start at 1any ideas? Quote Link to comment Share on other sites More sharing options...
micmania1 Posted January 19, 2007 Share Posted January 19, 2007 Create another table in your database for your sections. Include a section ID and maybe a section name. Now fo your products create a column which holds the section id.[code]$section_id = $_GET['section'];$query = "SELECT * FROM table1, sections WHERE table1.section_id=sections.section_id AND section=$section_id ORDER BY table1.section_id ASC";$result = @mysql_query($query);$num = mysql_num_rows($result); // number of products in specified section.// Returns products from only 1 section at a time[/code]A link would look like this,http://www.domain.com/page.php?section=1&product=67Hope this helps. Quote Link to comment Share on other sites More sharing options...
fazzfarrell Posted January 19, 2007 Author Share Posted January 19, 2007 Errmmm?I have one table with all the products in, numbered 1 - 300.The way the dat call in at the mo is one section at a time anyway, so I have no problem with that. It is the next and previous buttons, they all work and only calls the data in I want.If I click the result from the first section it brings up record 1 of 10, but if i click the second section it say record 11 of 10. It is just the number of the record I have a problem with I want it to see the first record as 1 and when you click 'next' it will be record 2 and so on although the ID is 11ta Quote Link to comment Share on other sites More sharing options...
micmania1 Posted January 19, 2007 Share Posted January 19, 2007 Can I please see your code?Check my profile for my msn if you have it. Quote Link to comment Share on other sites More sharing options...
fazzfarrell Posted January 22, 2007 Author Share Posted January 22, 2007 HiI have attached the file, seemed easier than trying to paste it in here![attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.