Jump to content

Display an entire row of data from table, and echo format in HTML


Xpluration

Recommended Posts

Right now, the code accesses a single row for the column "game1". How would the code look if it were to display all columns (game1, game2, game3 etc.) for that single row? And how would it display the data for each column in its own <td> </td>? Thanks for your time.

 

 

The table "trophy_display" looks like this:

trophytypegame1game2game3etc...

1datadatadataetc...

2datadatadataetc...

3datadatadataetc...

 

<?php

If(isset($_GET['user'])&&strlen($_GET['user'])!=0)
{
$username = $_GET['user'];
$usernamesql = mysql_query("SELECT * FROM usersystem WHERE username = '$username' LIMIT 1");
$usernamerow = mysql_fetch_array($usernamesql);
}

$trophyid = mysql_query("SELECT * FROM trophy WHERE userid = '{$usernamerow['userid']}' ");

while($row = mysql_fetch_array($trophyid)) {

$trophysql = mysql_query("SELECT * FROM trophy_display WHERE trophytype = '{$row['game1']}' ");
$trophyinfo = mysql_fetch_array($trophysql);

  echo "<tr>";
  echo "<td id=\"pbox5\">" . $trophyinfo['game1'] . "</td>";
  echo "<td id=\"pbox5\">" . $row['game2'] . "</td>";
  echo "<td id=\"pbox5\">" . $row['game3'] . "</td>";
  echo "<td id=\"pbox5\">" . $row['game3'] . "</td>";
  echo "<td id=\"pbox5\">" . $row['game4'] . "</td>";
  echo "<td id=\"pbox5\">" . $row['game5'] . "</td>";
  echo "<td id=\"pbox5\">" . $row['game6'] . "</td>";
  echo "<td id=\"pbox5\">" . $row['game7'] . "</td>";
  echo "<td id=\"pbox5\">" . $row['game8'] . "</td>";
  echo "</tr>";
  }
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.