...

View Full Version : mysql query failed



urgido
11-30-2006, 06:23 AM
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

The Reverend
11-30-2006, 07:57 AM
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?

urgido
11-30-2006, 08:01 AM
Your are right the error is just in a "" of in above line of that :/

Regards

urgido
11-30-2006, 08:14 AM
I have the following problem:



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!!

urgido
11-30-2006, 06:15 PM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum