Nickmadd Posted September 20, 2014 Share Posted September 20, 2014 Hey guys, I am just wondering what method is used to give my PHP loop lists there own page based on the same template for each one. A perfect example of this is eBay, if you look at the listing pages they then link to the actual product pages. I am just wondering how I can do this? Here is my code setup: <?php while($row = $results->fetch(PDO::FETCH_ASSOC)) { echo ' <div class="listing-container"> <h3 class="model-listing-title clearfix">'.$row["Make"].' '.$row["Model"].' '.$row["Variant"].'</h3> <h3 class="price-listing">£'.number_format($row['Price']).'</h3> </div> <div class="listing-container-spec"> <img src="'.(explode(',', $row["PictureRefs"])[0]).'" class="stock-img-finder"/> <div class="ul-listing-container"> <ul class="overwrite-btstrp-ul"> <li class="diesel-svg list-svg">'.$row["FuelType"].'</li> <li class="saloon-svg list-svg">'.$row["Bodytype"].'</li> <li class="gear-svg list-svg">'.$row["Transmission"].'</li> <li class="color-svg list-svg">'.$row["Colour"].'</li> </ul> </div> <ul class="overwrite-btstrp-ul other-specs-ul h4-style"> <li>Mileage: '.number_format($row["Mileage"]).'</li> <li>Engine size: '.$row["EngineSize"].'cc</li> </ul> <button href="#" class="btn h4-style checked-btn hover-listing-btn"><span class="glyphicon glyphicon-ok"></span> History checked </button> <button href="#" class="btn h4-style more-details-btn hover-listing-btn tst-mre-btn"><span class="glyphicon glyphicon-list"></span> More details </button> <button href="#" class="btn h4-style test-drive-btn hover-listing-btn tst-mre-btn"><span class="test-drive-glyph"></span> Test drive </button> <h4 class="h4-style listing-photos-count"><span class="glyphicon glyphicon-camera"></span> 5 More photos</h4> </div> '; } ?> </div> So as you can see I am using PDO to fetch this data from my database and sort the results to list every row of the SQL table into the HTML template I have made and is then looped. My question is how can I give each row in my SQL table it's own page just like the eBay example I mentioned? Does anyone know of any useful tutorials to achieve this or any examples of how this is done? Thanks Link to comment https://forums.phpfreaks.com/topic/291185-giving-my-php-loops-unique-pages-with-links/ Share on other sites More sharing options...
NotionCommotion Posted September 20, 2014 Share Posted September 20, 2014 I'm a little confused. I don't see any PDO, and your script seems to be unrelated to your questions. Normally, you would create a list with a bunch of links. Each link would be something like <a href="index.php?task=getItem&id=123 />Item 123</a>. Your server would then implement the getItem task and use the ID to create the page. Link to comment https://forums.phpfreaks.com/topic/291185-giving-my-php-loops-unique-pages-with-links/#findComment-1491673 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.