SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2012
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need to run while loop on a href tag

    Hey folks,

    I have the following problem, I have created a table that can be sorted and that records how often a link was clicked.
    My problem is that at this point i can only set the id manually and not as a part of the while loop, meaning if I want my url to go
    a certain site i am using the following code:
    Code:
     <td bgcolor="gray"><a href="click.php?id=2">' . $row['url'] . '</td>
    this code works fine but I dont want to have to set the ID to 2. I want the ID to automatically match the URL.

    Here is the whole while loop:

    Code:
     while ( $row = mysqli_fetch_assoc ( $result ) )
        {
                print '
                <tr>
                <td bgcolor="gray"><a href="click.php?id=2">' . $row['url'] . '</td>
                <td>' . $row['provby'] . '</td>
                <td>' . $row['description'] . '</td>
                </tr>';
        }
         
        print '</table>';
    Please let me know if I didnt explain it clearly enough or if you need to see more code to help me.
    I will be working on this for the rest of the night so i will reply fast

    Thanks a lot!
    Shibbs

  2. #2
    SitePoint Enthusiast
    Join Date
    Sep 2012
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Solved it!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •