#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Hong Kong
    Posts
    24
    Rep Power
    0
    here is my code:

    // user_profile is a table
    // password is a field in user_profile

    $selectStmt = "select password from user_profile WHERE userid=$form_userid";
    if (!($mailpwd = mysql_query($selectStmt, $link))) {
    DisplayErrMsg(sprintf("Error in executing %s stmt", $selectStmt));
    DisplayErrMsg(sprintf("error:%d %s", mysql_errno($link), mysql_error($link)));
    exit();
    }

    I want to retreive the string stored in 'password', and assign it to $mailpwd.
    but it doesnt work.
    pls help
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Hong Kong
    Posts
    24
    Rep Power
    0
    here is the error message:
    "Error in executing select password from user_profile WHERE userid=jlee stmt
    error:1054 Unknown column 'jlee' in 'where clause'"

    I am sure userid='jlee' is already stored in Mysql database...
    umm

  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Posts
    43
    Rep Power
    15
    Just a shot in the dark here:

    Try changing your first line to:

    $selectStmt = "select password from user_profile WHERE userid='$form_userid'";

    (adding apostrophes around $form_userid)

    Mike
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Hong Kong
    Posts
    24
    Rep Power
    0
    thanks mike
    it solved the error problem.
    but ....
    $mailpwd returned a value ="2"
    i guess mysql_query() tell u the number of rows.
    ------------
    | password |
    |----------|
    | mypwd |
    ------------

    how can i put 'mypwd' into $mailpwd ?
    ahhh pls help.

  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Hong Kong
    Posts
    24
    Rep Power
    0
    the problem solved.

    here is my code:

    $selectStmt = "select password from user_profile WHERE userid='$form_userid'";
    $result = mysql_query($selectStmt, $link);
    $row=mysql_fetch_object($result);
    mail("$email", "your password" ,"
    your password is: $row->password ");

    it works for me.
    hehe
    but i guess there must be way to shorten the program?

Similar Threads

  1. Newbie table creation question
    By andy collins in forum PostgreSQL Help
    Replies: 3
    Last Post: January 23rd, 2004, 03:27 PM
  2. ok super newbie question
    By SCerviche in forum Flash Help
    Replies: 5
    Last Post: January 11th, 2004, 03:29 PM
  3. Newbie Question
    By desiguy in forum PHP Development
    Replies: 3
    Last Post: December 21st, 2003, 03:32 PM
  4. newbie question
    By lottidah in forum .Net Development
    Replies: 2
    Last Post: December 8th, 2003, 03:11 PM
  5. newbie question on install
    By iwanaa in forum PHP Development
    Replies: 4
    Last Post: November 25th, 2003, 09:02 PM

IMN logo majestic logo threadwatch logo seochat tools logo