1

I have an HTML table which is generated from MySQL DB... works so far. I tried to insert an "update" button which selects the DB id of each row...

the one with the "->" is the one, that should generate the href:

What I get is: <a href"update.php?id= instead of <a href"update.php?id=[id]

Here is my code-snippet:

while ($zeile = mysqli_fetch_array( $db_erg, MYSQL_ASSOC))
      {
        echo "<tr>";
        echo "<td align=\"center\">". $zeile['vorname'] . "</td>";
        echo "<td align=\"center\">". $zeile['nachname'] . "</td>";
        echo "<td align=\"center\">". $zeile['gender'] . "</td>";
        echo "<td align=\"center\">". $zeile['gamertag'] . "</td>";
        echo "<td align=\"center\">". $zeile['mail'] . "</td>";
        echo "<td align=\"center\">". $zeile['age'] . "</td>";
        echo "<td align=\"right\">". $zeile['rank'] . "</td>";
        echo "<td align=\"right\">". $zeile['prime'] . "</td>";
        echo "<td align=\"right\">". $zeile['gametime'] . "</td>";
        echo "<td align=\"right\">". $zeile['msg'] . "</td>";
        echo "<td align=\"right\">". $zeile['status'] . "</td>";
  ->    echo "<td>". "<a href=\"update.php?id=\"".$zeile['id'].">update"."</a>"."</td>";

Any ideas? Thank you !

0

2 Answers 2

1

Try with

echo '<td><a href="update.php?id='.$zeile["id"].'">update</a></td>';
Sign up to request clarification or add additional context in comments.

2 Comments

works ! Thank you bud !!!
Please always explain your solutions... even when they are simple/obvious to you or most people.
0

You can simply use curly braces for this purpose. like below

echo "<td><a href='update.php?id={$zeile['id']}'>update</a></td>"; 

or you can use,

echo "<td><a href='update.php?id=".$zeile['id']."'>update</a></td>"; 

2 Comments

works ! Thank you so much ! Its much better with the braces !
yeah. with curly braces its looks neat.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.