Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

displaying more than one record

Status
Not open for further replies.

ameslee

Programmer
Feb 12, 2006
34
AU
hey can anyone help me with displaying more than one record? here is my code.
<html>
<head>
<title>Display all Users</title>
</head>
<body>
<h3>User Details</h3>
<?php
//database connection
include("database.inc");

$query = "Select * From `login`";
$mysql_result=mysql_query($query,$conn);
$row=mysql_fetch_row($mysql_result);
?>

<center>
<table width=100% border=1>
<tr>
<td><b>Username</b></td>
<td><b>Password</b></td>
<td><b>Level</b></td>
<td><b>Edit</b></td>
<td><b>Delete</b></td>

<?php
while ($row[0]!=""){
echo "<tr><td>$row[1]</td><td>$row[2]</td><td>$row[3]</td>";
echo "<td><a href='edit_user2.php?id=$row[0]'>Edit</a></td>";
echo "<td><a href='delete_checkuser2.php?id=$row[0]'>Delete</a></td></tr>";
$row=mysql_fetch_row($mysql_result);
}
?>
</table>
<p>
<a href="index.php">Main Menu</a>
</center>
</body>
</html>

at the moment it is displaying all the records but in between the 2nd and 3rd record there is a space.
can someone help me? thanks!
 
inbetween the two records? Do you mean in a certain field or?

Could you give us an example (like what it looks like) and then what is actually in the database?

-Kerry
 
i mean that in the 2nd and 3rd instead of displaying a record theres a empty line with no record in it. I have more than 3 records in my database so it should be displaying. Theres five columns, username, password, level, edit, delete. The database is just holding login information! hope this helps, thanks

 
one error which might give rise to strange html formatting is that you have not closed the table row on the headers. you need to add an "</tr>".

if this doesn't fix it please post back the html source code of an offending output. we can then see what has been added in and trace it back to the php code you've posted above. however the code appears well formed so i'm betting on an html error (like the one mentioned above).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top