First let me say that I'm relatively new to PHP and MySQL.
I've created a signup form which allows the user to enter the usual pertinent information - including the Zip Code. This is all saved in a DB. My intention is to call upon that DB on a second page to display the Zip Code for the signed-in user - I'm using this line of PHP at the moment, but it's displaying ALL the zipcodes for all users.
All I want to display is the Zip Code for the currently signed in user. How can I do this? Thanks.
Code:
<?
$connection = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>error");
mysql_select_db($dbname);
$query= "select * from users ";
$result= mysql_query($query);
$num_results = mysql_num_rows($result);
for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_array($result);
echo $row['zipcode'];} ?>