mysql query not being queried

Discussion in 'PHP' started by tintumon, Jun 20, 2010.

  1. #1
    The second and third queries dont get implemented, even though the if statement is true. Can anybody see something wrong in the code?
     
    tintumon, Jun 20, 2010 IP
  2. astrazone

    astrazone Member

    Messages:
    358
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    33
    #2
    try making a string first.

    $string = "UPDATE accounts SET password='$password' WHERE email='$email'";
    mysql_query($string);

    and try to run the query in phpmyadmin to check if the query is ok.

    good luck
     
    astrazone, Jun 20, 2010 IP
  3. lukeg32

    lukeg32 Peon

    Messages:
    645
    Likes Received:
    19
    Best Answers:
    1
    Trophy Points:
    0
    #3
    You should add some debug to your code to see what's going on; find out whats being returned in the row you are fetching, and check for errors in the 2 SQL commands that aren't being executed

    $fields = mysql_fetch_row($result);
    # whats been returned?
    print_r($fields);
    $email = $fields[1];
    
    mysql_query("UPDATE accounts SET password='$password' WHERE email='$email'") or die(mysql_error());
    
    mysql_query("DELETE * FROM newpassword WHERE code='$code'") or die(mysql_error());
    
    PHP:
     
    lukeg32, Jun 20, 2010 IP
  4. clox.c

    clox.c Peon

    Messages:
    30
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    couldn't agree more, probably there's something wrong with MySQL
     
    clox.c, Jun 20, 2010 IP