How would I go about showing part of a mysql table in PHP?
My table is named users, and it has 5 collumns, however, I only want 3 of them shown: user, password, address.
How could I do this?
I am wanting to use a template with this data:
<P ALIGN="LEFT">
<B>All Users</B>
<BR>
<TABLE WIDTH="100%" cellpadding="4" cellspacing="1" border="1">
<TR>
<TD><CENTER>Username</CENTER></TD>
<TD><CENTER>Password</CENTER></TD>
<TD><CENTER>Street</CENTER></TD>
</TR>
{TABLE}
</TABLE>
</P>
And then for the php, I tried this, but I am confused, and do not know what I am doing:
<?php
if ($modules) {
$admininfo['Fraud']['info'][] = array(
'name' => 'Users and IP',
'link' => $file,
);
return;
}
include './../includes/adminheader.php';
// page that confirms that it went thru okay? finished page?
/********** START DISPLAY INFORMATION *********/
$query = "SELECT * FROM users";
$result = mysql_query($query);
while($result3 = mysql_fetch_array($result)) {
$user_username = $result3['username'];
$user_password = $result3['password'];
$user_street = $result3['street'];
$table = "<TR>
<TD><CENTER>" . $user_username . "</CENTER></TD>
<TD><CENTER>" . $user_password . "</CENTER></TD>
<TD><CENTER>" . $user_street . "</CENTER></TD>
</TR>";
}
$tvars = array(
'TABLE' => $table,
'USERNAME' => $username,
'USER_ID' => $user_id
);
pparse('admin/users_all');
/********** END DISPLAY INFORMATION *********/
else {
// form fields, just 'name', 'desc', 'time', 'pts', 'link', 'img'
pparse('admin/users_all');
}
include './../includes/adminfooter.php';
?>
The biggest problem is that there is not a new link in the admin panel for All Users. So, I cannot test it. If I just go to the webpage thought I get:
Parse error: parse error, unexpected T_ELSE in /home/techgear/public_html/admin/users_all.php on line 37
Anyone have an Idea?