Jump to content

Using PHP to display MySQL data


kevincro

Recommended Posts

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

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!

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.