Jump to content

Displaying DB Rows in a table.


waynewex

Recommended Posts

Okay, when I use this page, all I get is... nothing. Not even the Title of the page will show. What do you think?

 

<?php session_start(); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Users</title>
</head>

<body><?php
$user="*******";
$password="********";
$database="*********";
$conn = mysql_connect("*************" ,$user,$password);
@mysql_select_db($database, $conn) or die(mysql_error);

$result = mysql_query("SELECT * FROM USERS");

echo = "<TABLE>";

while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['ID'] . "</td>";
  echo "<td>" . $row['NAME'] . "</td>";
  echo "<td>" . $row['USERNAME'] . "</td>";
  echo "<td>" . $row['EMAIL'] . "</td>";
  echo "</tr>";
  }
  
echo "</TABLE>";


mysql_close($conn);

?>

</body>
</html>

Link to comment
Share on other sites

Here's the current code:

 

$result = mysql_query("SELECT ID, EMAIL, NAME, USERNAME FROM USERS");

echo = "<TABLE>";

while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['ID'] . "</td>";
  echo "<td>" . $row['NAME'] . "</td>";
  echo "<td>" . $row['USERNAME'] . "</td>";
  echo "<td>" . $row['EMAIL'] . "</td>";
  echo "</tr>";
  }
  
echo "</TABLE>";


mysql_close($conn);

?>

</body>
</html>

Link to comment
Share on other sites

Try this as well:

 

<?php session_start(); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Users</title>
</head>

<body>
<TABLE>
<th>ID</th>
<th>NAME</th>
<th>USERNAME</th>
<th>EMAIL</th>
<?php
$user="*******";
$password="********";
$database="*********";
$conn = mysql_connect("*************" ,$user,$password);
@mysql_select_db($database, $conn) or die(mysql_error);

$result = mysql_query("SELECT * FROM USERS",$conn);

while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['ID'] . "</td>";
  echo "<td>" . $row['NAME'] . "</td>";
  echo "<td>" . $row['USERNAME'] . "</td>";
  echo "<td>" . $row['EMAIL'] . "</td>";
  echo "</tr>";
  }
  
mysql_close($conn);

?>
</TABLE>
</body>
</html>

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.