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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.