Sorrow Posted July 1, 2008 Share Posted July 1, 2008 Hi there here is my problem. I am doing a webpage for movie reviews. I have my reviews in a database. When I access the review page it display the list of the movie titles of all the reviews. each of them links to the same webpage. Here is what i want to do and cant figure out how.when i click on one of the link it needs to load the moviereview.php with the informations of the clicked link. but how can i select the right name that was clicked to access the right infos in my db??? Quote Link to comment Share on other sites More sharing options...
MatthewJ Posted July 1, 2008 Share Posted July 1, 2008 Create the url with a variable equal to the unique id of the record i.e. http://www.somepage.com?id=1234 Then use something like currId = $_GET['id'] to get the variable and use it in the query for the proper row like SELECT * from table WHERE id = currID Quote Link to comment Share on other sites More sharing options...
Sorrow Posted July 1, 2008 Author Share Posted July 1, 2008 Thank you it worked for the url but when i load my moviereview.php page nothing shows up. here is my code: the link that is in the adressbar is http://www.123.com/moviereview.php?index=1 <?php include 'opendb.php'; $currIndex = $_get['index']; $query = "SELECT * FROM reviews where m_index = $currIndex"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) echo "{$row['m_Link']}"; { echo "<img src={$row['m_Link']}> <br> ". "{$row['m_Review']} <br> "; } mysql_close($con); ?> 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.