Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder dniwebdesign's Avatar
    Join Date
    Dec 2003
    Location
    Carrot River, Saskatchewan
    Posts
    845
    Thanks
    15
    Thanked 10 Times in 10 Posts

    Why doesn't this retrveive and display info?

    Please See New Post...
    Last edited by dniwebdesign; 01-10-2004 at 07:12 AM.
    Dawson Irvine
    CEO - DNI Web Design
    http://www.dniwebdesign.com

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You missed a (concatination) dot before the $_SESSION['account '] inside your sql statement.

    Maybe take a look at your other thread Authenticate
    to se how i write such code and what the advantages of other codingstyles are ...

  • #3
    Regular Coder dniwebdesign's Avatar
    Join Date
    Dec 2003
    Location
    Carrot River, Saskatchewan
    Posts
    845
    Thanks
    15
    Thanked 10 Times in 10 Posts
    Okay... It still doesn't seem to want to find the info... It knows the account number and the password from the form to login. This is confusing me...

    PHP Code:
    <?php session_start(); ?>
    <?php 
    include 'home/sites/site58/users/dnidesign/web/clientarea/config.php'?>
    <?php
            $result
    =mysql_query("SELECT * from dnidesign_clients where account='".$_SESSION['account']."' and password='".$_SESSION['password']."'",$connection) or print mysql_error();
            if(
    mysql_num_rows($result))
            {
                while(
    $row=mysql_fetch_array($result))
                {
                    
    $account=$row["account"];
                    
    $password=$row["password"];
                    
    $firstname=$row["firstname"];
                    
    $lastname=$row["lastname"];
                    
    $company=$row["company"];
                    
    $address1=$row["address1"];
                    
    $address2=$row["address2"];
                    
    $town=$row["town"];
                    
    $province=$row["province"];
                    
    $postalcode=$row["postalcode"];
                    
    $country=$row["country"];
                    
    $phone=$row["phone"];
                    
    $fax=$row["fax"];
                    
    $email=$row["email"];
                    
    $website=$row["website"];
                    
    $paid=$row["paid"];
                    
    $balance=$row["balance"];
                    
                    
    $_SESSION['account'] = $account;
                    
    $_SESSION['password'] = $password;        // Register session key with the value 
                    
    $_SESSION['fullname'] = $fullname;        // Register session key with the value 
                    
    $_SESSION['company'] = $company;        // Register session key with the value 
                    
    $_SESSION['address1'] = $address1;        // Register session key with the value 
                    
    $_SESSION['address2'] = $address2;        // Register session key with the value 
                    
    $_SESSION['town'] = $town;        // Register session key with the value 
                    
    $_SESSION['province'] = $province;        // Register session key with the value 
                    
    $_SESSION['postalcode'] = $postalcode;        // Register session key with the value 
                    
    $_SESSION['country'] = $country;        // Register session key with the value 
                    
    $_SESSION['phone'] = $phone;        // Register session key with the value 
                    
    $_SESSION['fax'] = $fax;        // Register session key with the value 
                    
    $_SESSION['email'] = $email;        // Register session key with the value 
                    
    $_SESSION['website'] = $website;        // Register session key with the value 
                    
    $_SESSION['paid'] = $paid;        // Register session key with the value 
                    
    $_SESSION['balance'] = $balance;        // Register session key with the value 
        
                
    }
            }

    ?>
    Last edited by dniwebdesign; 01-10-2004 at 03:20 AM.
    Dawson Irvine
    CEO - DNI Web Design
    http://www.dniwebdesign.com

  • #4
    Regular Coder dniwebdesign's Avatar
    Join Date
    Dec 2003
    Location
    Carrot River, Saskatchewan
    Posts
    845
    Thanks
    15
    Thanked 10 Times in 10 Posts
    ?
    Dawson Irvine
    CEO - DNI Web Design
    http://www.dniwebdesign.com

  • #5
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    if(mysql_num_rows($result))

    is wrong.

    I suppose you want to see if the number of returned rows is 1, so you need
    if(mysql_num_rows($result)==1)

  • #6
    Regular Coder dniwebdesign's Avatar
    Join Date
    Dec 2003
    Location
    Carrot River, Saskatchewan
    Posts
    845
    Thanks
    15
    Thanked 10 Times in 10 Posts
    Why do you need the ==1 on the end?
    Dawson Irvine
    CEO - DNI Web Design
    http://www.dniwebdesign.com

  • #7
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    So if there's one result, it'll continue. If there's no rows found, it returns "0", which'll still make it continue in your script

  • #8
    Regular Coder dniwebdesign's Avatar
    Join Date
    Dec 2003
    Location
    Carrot River, Saskatchewan
    Posts
    845
    Thanks
    15
    Thanked 10 Times in 10 Posts
    It still didn't seem to help any though.
    Dawson Irvine
    CEO - DNI Web Design
    http://www.dniwebdesign.com


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •