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 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! 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 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
Archived
This topic is now archived and is closed to further replies.