Need help getting info from mysql and using IF
Posted: Fri May 22, 2009 5:06 pm
alright, im very new to php. I have been using ASP vb and figured it was time to upgrade my knowledge.
I am using the phpmotion script. What im trying to do is get the script to read from the databse if the user is an admin and if they are to change the $badge to a certain image, how the script has it coded is to add up all the video, image, music uploads together and depending on the value will determine which badge they get.
can anyone help with this please? here is some code from the script below
I just want to add an if statement in there some how so if its the admin it will have $badge = badge_admin.png
thanks in advance to everyone
I am using the phpmotion script. What im trying to do is get the script to read from the databse if the user is an admin and if they are to change the $badge to a certain image, how the script has it coded is to add up all the video, image, music uploads together and depending on the value will determine which badge they get.
can anyone help with this please? here is some code from the script below
Code: Select all
$sql = "SELECT user_group, user_name FROM member_profile WHERE user_id = '$member_id'";Code: Select all
$member_site_total = ( $member_videos + $member_audios + $member_albums + $member_blogs );
switch ( $member_site_total ) {
case $member_site_total >= 150:
$badge = 'badge_4.png';
break;
case $member_site_total >= 50:
$badge = 'badge_3.png';
break;
case $member_site_total >= 25:
$badge = 'badge_2.png';
break;
case $member_site_total >= 0:
$badge = 'badge_1.png';
break;
}
mysql_free_result($result);
return $badge;
}
thanks in advance to everyone