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 5 of 5
  1. #1
    Regular Coder
    Join Date
    Aug 2005
    Posts
    257
    Thanks
    8
    Thanked 0 Times in 0 Posts

    mysql query failed

    PHP Code:
    mysql_query("UPDATE users SET clicks=clicks+1 WHERE id=$id"); 
    I tried to increment +1 to my users but nothing happends. The field "clicks" is double on mysql.

    Can somebody give a hand?

    Regards

  • #2
    New Coder
    Join Date
    Mar 2006
    Location
    I'm lost, livin inside myself
    Posts
    97
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've used almost the exact same query in the past and it works fine for me, I don't see any problems with your syntax. Is it producing an error or is it just not doing anything?

  • #3
    Regular Coder
    Join Date
    Aug 2005
    Posts
    257
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Your are right the error is just in a "" of in above line of that :/

    Regards

  • #4
    Regular Coder
    Join Date
    Aug 2005
    Posts
    257
    Thanks
    8
    Thanked 0 Times in 0 Posts
    I have the following problem:

    PHP Code:
    if(isset($_GET['candy']) || (isset($_GET['salad']))){

    $link=mysql_connect("","","");
    mysql_select_db("");

    $result mysql_query("SELECT user FROM users WHERE user='$user'") or die("Query Error" mysql_error());

    if((
    mysql_num_rows($result)>0) && $candy){
     
    mysql_query("UPDATE users SET candy=yes WHERE user='$user'");
     echo 
    "Thank u";
    }else if((
    mysql_num_rows($result)>0) && $salad){
     
    mysql_query("UPDATE users SET salad=yes WHERE user='$user'");
     echo 
    "Thank u";
    }
    // HERE IS THE PROBLEM, THIS ELSE IF DON'T WORK!!!!
    else if((mysql_num_rows($result)==0) && $candy){
     
    mysql_query("INSERT INTO users (candy,user) VALUES('no','$nickname'");
     echo 
    "Added";
    }


    In the last else if is my problem.

    But not work!!
    Last edited by urgido; 11-30-2006 at 09:05 AM.

  • #5
    Regular Coder
    Join Date
    Aug 2005
    Posts
    257
    Thanks
    8
    Thanked 0 Times in 0 Posts
    i found the f** problem, if i have more than 1 row in my table thhis "else if" is not executed. How I can solved this problem?

    Regards


  •  

    Posting Permissions

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