Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
tchague1
Starting Member
1 Post |
Posted - 2011-04-18 : 12:07:48
|
Hi guys,I'm a bit of a novice with SQL, so please bare with me if what I'm saying sounds stupid.Anyway, I'm making a review database for a website. And on the review page of the website, I want it to give me a preview of all the reviews (Review title, picture of item been reviewed, and cost of item). I have managed this fine.But now I want to be able to click on the review title, which will take me to another HTML page and show me the full review. So really, by clicking on the review title, it'll take the review ID to another page, and query that ID to show me the full review.But I've not got a clue as to how to go about doing it. The code I've got for the review preview page is as follows:<?php $sql = "select * from reviews WHERE `review_catagory` = 'Walking' AND `review_sub_catagory` = 'Footwear' ORDER BY date_added DESC limit 10"; $result = mysql_query($sql) or die ("Could not access DB: " . mysql_error()); while ($row = mysql_fetch_assoc($result)) { echo "<div class=\"picture\">"; echo "<p>"; echo "<table width='660' border='0' cellspacing='0' cellpadding='0'> <tr><th></th><th></th><th></th><th></th></tr>";echo "<tr>"; echo "<td width='300' align='center'>" . $row['product_name'] . "</td>"; echo "<td width='100' align='center'>" . $row['rrp'] . "</td>"; echo "<td width='160' align='center'>" . "<img width='36%' height='36%' src=\"../../reviews/images_to_be/" . $row['filename'] . "\" alt=\"\" /> "; "</td>"; echo "<td width='100' align='center'>" "</td>"; echo "</tr>"; echo "<hr />"; }echo "</table>";echo "</table>";echo "</table>";echo "</table>";?> |
|
|
ajthepoolman
Constraint Violating Yak Guru
384 Posts |
Posted - 2011-04-18 : 13:53:00
|
| I know zero about PHP, but if you want people to click on the name and be directed to another page then the name has to be wrapped in an anchor tag with a parameter hooked to it with the ID that you want passed."<a href='somePage.html?ID=" + $row['ID'] + "'>" + $['product_name'] + "</a>"Then on your page you sent them to, you should be able to grab "ID" from the QueryString property of the URL.Hey, it compiles. |
 |
|
|
|
|
|
|
|