Jump to content

Can insert but not update?


Sinikka

Recommended Posts

I'm having a problem getting the value to update for the total amount of avatars a person has when they unlock a new one. I've been sitting here looking at the code for the last hour and for the life of me I can't figure out what I'm doing wrong.

 

if ($members[username] == pinknailpolish){
$sql = mysql_query("SELECT * FROM avatar WHERE user_name = '$userid' AND avatar_name = 'Cactus Addict'");
$result = mysql_num_rows($sql);

if($result=="0")
{
$sql = mysql_query("INSERT INTO avatar (user_name, avatar_name, avatar_id) VALUES ('$userid','Cactus Addict','5')");
mysql_query("UPDATE members2 SET avie_count=$members[avie_count]+1 WHERE username = '$userid' AND game = '$game'");

if(!$sql)
        { 
    echo "Error performing query: ".mysql_error(); 
        }
else 
            { 
   $avie0= "<center><br><table width=300 border=1 cellpadding=4 cellspacing=0 bordercolor=#000000 bgcolor=#ffffff><tr><td><img src=images/user_images/opg_1/avies/cactusaddict.gif width=70 height=70 hspace=10 align=left><font color=#000000 size=3 face=verdana><b>Congratulations $username</b></font><font size=2 face=verdana><br><br>You can now use Cactus Addict as an avatar on the forums! </font></td></tr></table></center>"; 
}
}
}

Link to comment
https://forums.phpfreaks.com/topic/76743-can-insert-but-not-update/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.