Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8472009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:57:02+00:00 2026-06-10T16:57:02+00:00

I am trying to run a mysql query within some php and have the

  • 0

I am trying to run a mysql query within some php and have the results echoed as HTML. I got it working but now I would like to insert an id into the links so I can use a page to GET the id. Does anyone know how to do this. What I have tried (and is not working) is below. And at the bottom of the post is what was working originally, but without an id on the link…

    <?
    echo "<tr bgcolor=\"#CCCCCC\" style=\"border-bottom:1px solid gray;\"><td> Team </td><td>Correct Picks</td><td>Points</td></tr>";
    while($row = mysql_fetch_array($memberslist)) {
        if ($row['User_ID'] == $id) {
            echo "<tr bgcolor=\"#F0F0F0\"><td>" . "<a href=\"2012week1.php?id=\"$row['User_ID']\"\">$row[User_ID]</a>" . "</td><td><b>" . $row['Correct_Picks'] . " </b> /" . $maxcorrectpicks . "</td><td>" . $row['Points'] . "</td></tr>";
        } else {
            echo "<tr><td>" . "<a href=\"2012week1.php?id=\"$row['User_ID']\"\">$row[User_ID]</a>" . "</td><td><b>" . $row['Correct_Picks'] . " </b> /" . $maxcorrectpicks . "</td><td>" . $row['Points'] . "</td></tr>";
    }
    }
    ?>

 $uniqueid = $_GET["$row['User_ID']"];
 echo $uniqueid;

This is from the first page that worked…

    <?
    echo "<tr bgcolor=\"#CCCCCC\" style=\"border-bottom:1px solid gray;\"><td> Team </td><td>Correct Picks</td><td>Points</td></tr>";
    while($row = mysql_fetch_array($memberslist)) {
        if ($row['User_ID'] == $id) {
            echo "<tr bgcolor=\"#F0F0F0\"><td>" . "<a href=\"2012week1.php\">$row[User_ID]</a>" . "</td><td><b>" . $row['Correct_Picks'] . " </b> /" . $maxcorrectpicks . "</td><td>" . $row['Points'] . "</td></tr>";
        } else {
            echo "<tr><td>" . "<a href=\"otherteam.php\">$row[User_ID]</a>" . "</td><td><b>" . $row['Correct_Picks'] . " </b> /" . $maxcorrectpicks . "</td><td>" . $row['Points'] . "</td></tr>";
    }
    }
    ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T16:57:04+00:00Added an answer on June 10, 2026 at 4:57 pm

    The problem that you are having is that you are trying to access an array element from within double quotes. You could make this work by wrapping it in curly braces {$row['User_ID']}.

    To make your code more readable, and to avoid this problem, just concatenate or use a list of values for echo. I also recommend the usage of htmlspecialchars() to ensure you are creating valid HTML.

    echo '<tr><td>',
      '<a href="2012week1.php?id=',
      htmlspecialchars($row['User_ID']),
      '">',
      htmlspecialchars($row[User_ID]),
      '</a>',
      '</td><td>'
      //etc.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to run a mysql insert query using php exec with parameters.
I am trying to run multiple queries on some mysql dbs from a php
I'm trying to run a MySQL query depending on what HTML selectbox option is
I am trying to run a MySQL query but I am having trouble with
I have a MySQL query that I'm trying to run in SQLite. I found
Trying to run my program in FreeBSD OS, I have the following results: $
Today I am trying to echo this php mysql statement within my javascript code,
I am trying to run a MySQL query using RMySQL which includes a LIKE
I am trying to run the following query, but am getting a sql syntax
I am trying to run a script from within a script and have the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.