Jump to content

Recommended Posts

ok im trying to get this IF command to work right so if a user doesnt have a avatar it goes to the default one but if the do it will display it.

 

$avatarinfo = mysql_query("SELECT user.avatarid, user.avatarrevision, avatarpath, NOT ISNULL(customavatar.userid) AS hascustom, customavatar.dateline,customavatar.width, customavatar.height FROM vb_user AS user LEFT JOIN vb_avatar AS avatar ON avatar.avatarid = user.avatarid LEFT JOIN vb_customavatar AS customavatar ON customavatar.userid = user.userid WHERE user.userid = '$userid'");
while ($query_row=mysql_fetch_array($avatarinfo)) {

if (!$avatarinfo) {
$avatarurl= imagecreatefromgif('forums/images/avatars/noavatar.gif');
} else {
$avatarurl= imagecreatefromgif("forums/$query_row[avatarpath]");
}

}

 

any help is appreciated

Link to comment
https://forums.phpfreaks.com/topic/64434-trying-to-do-a-if-function-but-wont-work/
Share on other sites

Not sure...

 

but you could give it a try:

 

$avatarinfo = mysql_query("SELECT user.avatarid, user.avatarrevision, avatarpath, NOT ISNULL(customavatar.userid) AS hascustom, customavatar.dateline,customavatar.width, customavatar.height FROM vb_user AS user LEFT JOIN vb_avatar AS avatar ON avatar.avatarid = user.avatarid LEFT JOIN vb_customavatar AS customavatar ON customavatar.userid = user.userid WHERE user.userid = '$userid'");
while ($query_row=mysql_fetch_array($avatarinfo)) {

if (!$avatarinfo == "") {
$avatarurl= imagecreatefromgif('forums/images/avatars/noavatar.gif');
} else {
$avatarurl= imagecreatefromgif("forums/$query_row[avatarpath]");
}

}

fixed just took a bit of tinkering thanks for your help

 

$avatarinfo = mysql_query("SELECT user.avatarid, user.avatarrevision, avatarpath, NOT ISNULL(customavatar.userid) AS hascustom, customavatar.dateline,customavatar.width, customavatar.height FROM vb_user AS user LEFT JOIN vb_avatar AS avatar ON avatar.avatarid = user.avatarid LEFT JOIN vb_customavatar AS customavatar ON customavatar.userid = user.userid WHERE user.userid = '$userid'");
while ($query_row=mysql_fetch_array($avatarinfo)) {
$avatarpat = "$query_row[avatarpath]";

if ($avatarpat == "") {
$avatarurl= imagecreatefromgif('forums/images/avatars/noavatar.gif');
} else {
$avatarurl= imagecreatefromgif("forums/$avatarpat");
}

}

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.