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>";
  }
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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