xyn Posted September 24, 2006 Share Posted September 24, 2006 Hio,I'm having a small problem with PHP, he seems to be gettingon my nerves tonight, well the thing is I have a avatar formy members, yet I wanted to check if they ahve an avataror give them the default avatar.So I check mysql as you do, and PHP doesn't seem to outputanything :/ could someone check my code, thx.[code=php:0]<?PHP include("session.php"); $SQLB = mysql_query("SELECT filename FROM avatar WHERE user='{$_SESSION['username']['usr_user']}'"); while( $Data = mysql_fetch_array( $SQLB, MYSQL_NUM )){ $NUMB = mysql_num_rows( $SQLB ); if( !$NUMB ){ $avatar="avatar.PNG"; }else{ $avatar = $Data[0]; } }?><p>text here<br><img border="0" src="./global/images/private/<?PHP echo $avatar; ?>" alt="Avatar"></p>[/code] Quote Link to comment Share on other sites More sharing options...
Barand Posted September 24, 2006 Share Posted September 24, 2006 If there is no data found, code inside the while loop is not executed Quote Link to comment Share on other sites More sharing options...
xyn Posted September 24, 2006 Author Share Posted September 24, 2006 How could i fix it? Quote Link to comment Share on other sites More sharing options...
Barand Posted September 24, 2006 Share Posted September 24, 2006 [code]<?php include("session.php"); $SQLB = mysql_query("SELECT filename FROM avatar WHERE user='{$_SESSION['username']['usr_user']}'");$NUMB = mysql_num_rows( $SQLB );if( !$NUMB ){ $avatar="avatar.PNG";}else{ $Data = mysql_fetch_array( $SQLB, MYSQL_NUM ); $avatar = $Data[0];}?><p>text here<br><img border="0" src="./global/images/private/<?php echo $avatar; ?>" alt="Avatar"></p>[/code] Quote Link to comment Share on other sites More sharing options...
xyn Posted September 24, 2006 Author Share Posted September 24, 2006 worked. thanks :]. just confused me! thanks again. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.