[PHP&HTML]Tables are messed up =/
What i get:
http://uploads.screenshot-program.com/upl4501110420.jpg
What im trying to get:
http://uploads.screenshot-program.com/upl3411002871.jpg
I don't know how to do this :(
PHP Code:
<?php include('includes/header.php');?>
<h2>Accounts</h2>
<?php
$accountsquery=mysql_query("SELECT * FROM accounts");
while($acc=mysql_fetch_assoc($accountsquery)){
$accusername=$acc['username'];
$accpassword=$acc['password'];
$accpassword=str_replace("412start94","*******",$accpassword);
$accpassword=str_replace("4132088","********",$accpassword);
$accpassword=str_replace("gokken","*******",$accpassword);
$accpassword=str_replace("hanna1","********",$accpassword);
$accid=md5($accpassword);
$accrealid=$acc['ID'];
?>
<table>
<tr>
<th><strong>ID</strong></th>
<th>Username</th>
<th>Password</th>
<th>Hash</th>
</tr>
<tr>
<?php
echo'<td>'.$accrealid.'</td><td>'.$accusername.'</td><td>'.$accpassword.'</td><td>'.$accid.'</td>';
?>
</tr>
</table><?php }?>
<?php include('includes/footer.php');?>
Help please?
Re: [PHP&HTML]Tables are messed up =/
try to elaborate more. i still dont understand what you are trying to do.
Re: [PHP&HTML]Tables are messed up =/
Im trying to make it so that ID, User,pass,and hash only appear once instead of like 2000 times.
Re: [PHP&HTML]Tables are messed up =/
if ur using dreamweaver and u must put a script in the table of a size, and i think u must lock the table size
Re: [PHP&HTML]Tables are messed up =/
i think it's because your using while.
PHP Code:
while($acc=mysql_fetch_assoc($accountsquery)){
$accusername=$acc['username'];
$accpassword=$acc['password'];
$accpassword=str_replace("412start94","*******",$accpassword);
$accpassword=str_replace("4132088","********",$accpassword);
$accpassword=str_replace("gokken","*******",$accpassword);
$accpassword=str_replace("hanna1","********",$accpassword);
$accid=md5($accpassword);
$accrealid=$acc['ID'];
?>
<table>
<tr>
<th><strong>ID</strong></th>
<th>Username</th>
<th>Password</th>
<th>Hash</th>
</tr>
<tr>
<?php
echo'<td>'.$accrealid.'</td><td>'.$accusername.'</td><td>'.$accpassword.'</td><td>'.$accid.'</td>';
?>
place the table info before your while and it should work.
Re: [PHP&HTML]Tables are messed up =/
Try this?
PHP Code:
<?php include('includes/header.php');?>
<h2>Accounts</h2>
<?php
$query=mysql_query("SELECT * FROM accounts DESC ID LIMIT 10");
while($acc=mysql_fetch_assoc($query)){
?>
<table>
<tr>
<th><strong>ID</strong></th>
<th>Username</th>
<th>Password</th>
<th>Hash</th>
</tr>
<tr>
<?php
echo'<td>'.$acc['ID'].'</td><td>'.$acc['username'].'</td><td>'.$acc['password'].'</td><td>'.md5($acc['password']).'</td>';
?>
</tr>
</table>
<?php
}
?>
<?php include('includes/footer.php');?>
And try not to be so sloppy with it. If you use LIMIT number itll drop how many display, then create your own way of displaying so many, or even make a search function for it if you like. Since this is more then likely for a admin panel. I'd use a search function myself..
Re: [PHP&HTML]Tables are messed up =/
like i said before. the table has to be before the while. -.-
PHP Code:
<?php include('includes/header.php');?>
<h2>Accounts</h2>
<table>
<tr>
<th><strong>ID</strong></th>
<th>Username</th>
<th>Password</th>
<th>Hash</th>
</tr>
<?php
$query=mysql_query("SELECT * FROM accounts DESC ID LIMIT 10");
while($acc=mysql_fetch_assoc($query)){
echo'<tr><td>'.$acc['ID'].'</td><td>'.$acc['username'].'</td><td>'.$acc['password'].'</td><td>'.md5($acc['password']).'</td></tr>';
}
?>
</table>
<?php include('includes/footer.php');?>
Re: [PHP&HTML]Tables are messed up =/
The tables don't need to be before the while, all he wants it to do is stack displaying the data which would require multiple tables. In which case you would want to use them in the while. So it echos a new one for each group of information. From what I got the problem is its displaying every user in the table when hes only wanting it to display so many hence the "Its displaying to many" which is why I suggested the LIMIT, also if the tables was before the while these wouldnt be displayed as they're displayed in the picture above. They would be aligned side by side untill the width is met then start a second row and repeating untill all the data is displayed.
Re: [PHP&HTML]Tables are messed up =/
noo. since the table is in the while. it would create a new table every time. with a header every time. -.-
Re: [PHP&HTML]Tables are messed up =/
Waitttt I just understood after rereadin it >.> I was up all last night when i read it, yeah the table would be at the beggining, then the while with a /table at the end. So yeah this would be it...
PHP Code:
<?php include('includes/header.php');?>
<h2>Accounts</h2>
<?php
?>
<table>
<tr>
<th><strong>ID</strong></th>
<th>Username</th>
<th>Password</th>
<th>Hash</th>
</tr>
<?php
$query=mysql_query("SELECT * FROM accounts DESC ID LIMIT 10");
while($acc=mysql_fetch_assoc($query)){
echo'<tr><td>'.$acc['ID'].'</td><td>'.$acc['username'].'</td><td>'.$acc['password'].'</td><td>'.md5($acc['password']).'</td></tr>';
}
?>
</table>
<?php
include('includes/footer.php');
?>
Re: [PHP&HTML]Tables are messed up =/
yeah. you also have a pointless php open and close. haha.
sorry.
=]]