Avatar On @ Off switch

Started on the old forum in May 2009 · view the original in the archive · old links redirect here

2 replies · 397 views · started 17 years ago · 1 min read

2 participants
riderz Lead · 975 posts #1

Ok guys ive being playing around with these codes and stuff but still cant get it to work index.php

 $showavatar = mysql_fetch_array(mysql_query("SELECT showavatar FROM ibwf_users WHERE id='".$uid."'"));
 if($showavatar[0]=="1")
{
$avlink = getavatar($item[2]);
if ($avlink!=""){
echo "<img src=\"$avlink\" height=\"25\" width=\"25\" alt=\"avatar\"/>";
}else{
echo "<img src=\"/images/nopic.jpg\" height=\"25\" width=\"25\" alt=\"avatar\"/>";
}
}
echo "<small>Show Avatar online?:</small> <select name=\"showavatar\" value=\"$showavatar[0]\">";
    if($showshout[0]=="1"){
    echo "<option value=\"1\" selected=\"1\">Yes</option>";
    }else{
    echo "<option value=\"1\">Yes</option>";
    }
    if($showavatar[0]=="0"){
    echo "<option value=\"0\" selected=\"0\">No</option>";
    }else{
    echo "<option value=\"0\">No</option>";
    }
    echo "</select><br/><br/>";

genproc.php

   $showavatar = $_POST["showavatar"];
  $res = mysql_query("UPDATE ibwf_users SET showavatar='".$showavatar."' WHERE id='".$uid."'");  

and in sql ive added this

showavatar  int 100 default 1

what can i do to make this code work


Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

jsyguy23 Developer · 134 posts #2

if($showavatar[0]>"1") { $avlink = getavatar($item[2]); if ($avlink!=""){ echo "<img src="$avlink" height="25" width="25" alt="avatar"/>"; }else{ echo "<img src="images/nopic.jpg" height="25" width="25" alt="avatar"/>"; } }

try that m8

riderz Lead · 975 posts #3

Sorry guys my code work 100% that ive posted i have just tried it the way ive posted it and it work last time ive tried it was on my localhost then it didnt work


Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close