Search code examples
phphtmlmysqlcsshref

Adding mysql row to end of href in a table


I am trying to add the content of a cell in a mysql row at the end of href in a table

This works without the row being added to the end of the href. Its a while loop so I wrapped the whole loop in a php bracket

echo "<td><a href=\"https://website/call?\">" . $row['TXID'] . "</a></td>";

But when I try to add in the "TXID" it errors out and the page doesnt load. I have tried a few solutions on here which lead me to escaping the \" for the href but im not sure why it isnt working.

echo "<td><a href=\"https://website/call?' . $row['TXID'] . '\">" . $row['TXID'] . "</a></td>";

Is it just my syntax that is wrong or am I missing something?

I apologize if this is a duplicate. I couldnt find anything for this exact situation that worked for me.


Solution

  • you have syntax error try this

    echo "<td><a href='https://website/call?{$row['TXID']} '>" . $row['TXID'] . "</a></td>";