kevincro Posted October 12, 2007 Share Posted October 12, 2007 My question concerns displaying MySQL data. I've coded a form page, a process page, and a display page. However, I want to add a link in each row on my display page that will open a new page and display the data that corresponds to that row only. How is this accomplished? thanks kevincro Quote Link to comment https://forums.phpfreaks.com/topic/72895-using-php-to-display-mysql-data/ Share on other sites More sharing options...
harristweed Posted October 12, 2007 Share Posted October 12, 2007 Have a link from each row in the display page that has the id of the data that will be displayed on the new page... <a href="new_page.php?item_id=432">new page</a> In the new page have the code: $data_key=$_GET['item_id']; Then the sql query, something like: $select ="select * from table name where id_field = '$data_key' "; Display results! Quote Link to comment https://forums.phpfreaks.com/topic/72895-using-php-to-display-mysql-data/#findComment-367693 Share on other sites More sharing options...
kevincro Posted October 12, 2007 Author Share Posted October 12, 2007 My display page has the following code: $sql = "SELECT * FROM stake_view"; $query = mysql_query($sql); while ($row = mysql_fetch_array($query)){ echo "<tr>"; echo "<td>".$row['xxxx']."</td>"; echo "<td>".$row['xxxx']."</td>"; echo "<td>".$row['xxxx']."</td>"; echo "<td>".$row['xxxx']."</td>"; echo "<td>".$row['xxxx']."</td>"; echo "<td>".$row['xxxx']."</td>"; echo "<td>".$row['xxxx']."</td>"; echo "<td>".$row['xxxx']."</td>"; echo "<td>".$row['xxxx']."</td>"; echo "<td>".$row['xxxx']."</td>"; echo "</tr>"; } ?> My question is, how do I include the following line of code so that the link shows up on each row of data? <a href="mypage.php?item_id=<?php $row['xxxx']?>">Apply Quote Link to comment https://forums.phpfreaks.com/topic/72895-using-php-to-display-mysql-data/#findComment-368159 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.