Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Displaying all of the row (MySQL)??
Old 10-26-2008, 03:15 PM Displaying all of the row (MySQL)??
Average Talker

Posts: 24
Location: Boston, MA
Trades: 0
Hi all.

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'];} ?>
__________________

Please login or register to view this content. Registration is FREE
spunko2010 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-26-2008, 04:48 PM Re: Displaying all of the row (MySQL)??
lothop's Avatar
Ultra Talker

Posts: 303
Trades: 0
How are you storing who is actually signed in?
you would need to deferintiate between each user.

So if jim logins it searches only for jims zip code and displays it.
__________________
Websites Created;
warscope.com
ratepayers.org.nz
lothop is offline
Reply With Quote
View Public Profile
 
Old 10-26-2008, 07:58 PM Re: Displaying all of the row (MySQL)??
Average Talker

Posts: 24
Location: Boston, MA
Trades: 0
Hi there,

Thanks for this, I managed to solve it via adding an additional line to the cookie for the ZIP.
__________________

Please login or register to view this content. Registration is FREE
spunko2010 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Displaying all of the row (MySQL)??
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.33475 seconds with 12 queries