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?

    Well, there seems to be an unexpected else statement ni youy code. From the snippet you placed here, it would be in the last section. If it is linked to the if statement in the top of the code, you ahve to make sure your 'curly brackets' match up. now you close the if-section after the return, which makes sense. But your else would have to follow straight after that.

    Also, when you are filling the table array, I think you would want to use (Note the added dot!):

    
                $table. = "<TR>
                            <TD><CENTER>" . $user_username . "</CENTER></TD>
                            <TD><CENTER>" . $user_password . "</CENTER></TD>
                            <TD><CENTER>" . $user_street . "</CENTER></TD>
                            </TR>"; 
    

    For convenience, you do not need to make variables first, use:

    
            $query = "SELECT * FROM users";
            $result = mysql_query($query);
            while($result3 = mysql_fetch_array($result)) 
      {
    
    
                $table .= "<TR>
                            <TD><CENTER>" . $result3['username'] . "</CENTER></TD>
                            <TD><CENTER>" . $result3['password']. "</CENTER></TD>
                            <TD><CENTER>" . $result3['street'] . "</CENTER></TD>
                            </TR>";
            }
    
      Write a Reply...