Jump to content

Recommended Posts

I'm trying to add the following link to my display page.  <a href="applyforstake.php?item_id=1>Apply"

 

This is the code taken directly from the display page:

 

echo "<td>"."<a href="applyforstake.php?item_id=1">Apply"."</td>";

 

This code works well for displaying the link in my display page, however, I want the item_id to be equal to the auto_increment column on each row.  In other words, for the first row on the display page, the item_id will be 1, the second row item_id should be 2 and so on for however many rows are in the table.  How do I accomplish this.

Link to comment
https://forums.phpfreaks.com/topic/73262-solved-help-with-a-loop/
Share on other sites

I'm confident that this solution will work with some tweeking. As it stands, when I try it, it puts 30 apply buttons on each displayed row, each button having a unique $id.  I'll play around with it and see what I can come up with. I'll post the results.  Thanks so much for your help.  I've been 4 days trying to get this to work. lol.

 

Okay this is rather embarrassing.  This is all I had to do the whole time.  I had tried something similar but apparently didn't have my variable in the right spot.

 

$id = $row['indexcolumname'];

echo "<td>"."<a href=\"applyforstake.php?item_id=$id\">Apply"."</td> <br>";

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.