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
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!

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.