Professional Web Applications Themes

My_SQL retreival... - PHP Development

Hi all, Using PHP to retrieve data out of a PHP table called Users There are 10 fields in the table, but I just want the first three called user_name user_pass user-email user_name is the primary key... now - how do i get just these three fields and stick them into php variables... I can connect to the database and everything - I just need the Select Statement and the way to get the query result into PHP variables... TIA Andy Mak...

  1. #1

    Default My_SQL retreival...

    Hi all,

    Using PHP to retrieve data out of a PHP table called Users

    There are 10 fields in the table, but I just want the first three called

    user_name
    user_pass
    user-email

    user_name is the primary key...

    now - how do i get just these three fields and stick them into php
    variables...

    I can connect to the database and everything - I just need the Select
    Statement and the way to get the query result into PHP variables...

    TIA
    Andy Mak


    Domestos Guest

  2. #2

    Default Re: My_SQL retreival...

    HI,

    The select statement is
    "select user_name, user_pass, user_email from ??? where
    user_name='$queryuser'"
    $queryuser is the variable contains the user you want to retreive, ???
    is the table name.

    use mysql_fetch_object() to retreive the row object and use it
    $data = mysql_fetch_object($result) ;
    echo($data->user_name, $data->user_pass, $user_email) ;

    Hopes this can help.

    Danny Wong

    "Domestos" <net> 撰寫於郵件新聞:J4Gte.29644$%ntli.net... 


    Danny Guest

  3. #3

    Default Re: My_SQL retreival...

    Hi,

    "Domestos" <net> wrote in message
    news:J4Gte.29644$%ntli.net... 

    How about this:

    // $link is the returned resource variable from the DB connection statement
    $res = mysql_query("SELECT user_name, user_pass, user-email from Users",
    $link);
    $i = 0;
    // fetch each record into the array $arr one by one
    while ($arr = mysql_array_fetch($res, MYSQL_ASSOC)) {
    $username[$i] = $arr["user_name"] ;
    $userpass[$i] = $arr["user_pass"];
    $useremail[$i] = $arr["user-email"];
    $i++;
    }

    Best Regards,
    LaBird (Benny).
    [email: remove all numerals to get the correct one]
     


    LaBird Guest

Similar Threads

  1. Active Directory OU Retreival
    By multisync in forum ASP.NET Web Services
    Replies: 2
    Last Post: December 8th, 04:22 PM
  2. Date/time limit on retreival for today only.
    By Jim in forum Coldfusion - Advanced Techniques
    Replies: 7
    Last Post: August 22nd, 10:38 PM
  3. SMTP mail retreival
    By NFDC Web in forum Coldfusion - Advanced Techniques
    Replies: 3
    Last Post: April 13th, 01:55 PM
  4. admin password retreival
    By zoe in forum Windows Setup, Administration & Security
    Replies: 1
    Last Post: July 27th, 01:47 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139