Jump to content

[SOLVED] select list now showing?


darkfreaks

Recommended Posts

<select><?php
	$sql11 = "select * from `avatar_blank` where `user_name` = '$username'";
   		$query11 = mysqli_query($sql11) or die(mysqli_error());
      				while($dd11 = mysqli_fetch_array($query11)){
	$avatar_name = $dd11['avatar_name'];

if($avatar_name == "staff_m"){
$a_Show = "Staff: Male";
}else if($avatar_name == "staff_f"){
$a_Show = "Staff: Female";
}else if($avatar_name == "baby_kow"){
$a_Show = "Baby Kow";
}else if($avatar_name == "auctioneer"){
$a_Show = "Auctioneer";
}else if($avatar_name == "bidder"){
$a_Show = "Bidder";
}else if($avatar_name == "tycoon"){
$a_Show = "Tycoon";
}else if($avatar_name == "snot"){
$a_Show = "Snot Boy";
}else if($avatar_name == "i_heart_jaqorse"){
$a_Show = "I Love Jaqorse!";
}else if($avatar_name == "quacka_splash"){
$a_Show = "Quacka Splash!";
}else if($avatar_name == "ecard"){
$a_Show = "eCard";
}else if($avatar_name == "gumball"){
$a_Show = "Gumball";
}else if($avatar_name == "butterfly"){
$a_Show = "Beautiful Butterfly";
}else if($avatar_name == "snowball_attack"){
$a_Show = "Snowball Attack!";
}else if($avatar_name == "oinkerz"){
$a_Show = "Oinkerz!";
}else if($avatar_name == "flower_face"){
$a_Show = "Flower Face!";
}else if($avatar_name == "emo"){
$a_Show = "Emo!";
}else if($avatar_name == "i_love_dibbles"){
$a_Show = "I Love Dibbles!";
}else if($avatar_name == "grabatron"){
$a_Show = "Grabatron!";
}else if($avatar_name == "pop"){
$a_Show = "POP!";
}else if($avatar_name == "artist"){
$a_Show = "Artist!";
}else if($avatar_name == "bookworm"){
$a_Show = "Book Worm";
}else if($avatar_name == "vote"){
$a_Show = "VOTE";
}else if($avatar_name == "police"){
$a_Show = "Police";
}else if($avatar_name == "mod"){
$a_Show = "Mod";
}else if($avatar_name == "admin"){
$a_Show = "Admin";
}else if($avatar_name == "moon"){
$a_Show = "Chicka Moon";
}else if($avatar_name == "fireworks"){
$a_Show = "Fireworks";
}else if($avatar_name == "fireworks2"){
$a_Show = "4th of July";
}else if($avatar_name == "lucky_7"){
$a_Show = "Lucky 7";
}else if($avatar_name == "chimbana"){
$a_Show = "Chimbana Attack";
}else if($avatar_name == "gundana"){
$a_Show = "Gundana";
}else if($avatar_name == "spidora"){
$a_Show = "Webbed";
}else if($avatar_name == "draw"){
$a_Show = "Draw";
}else if($avatar_name == "premium"){
$a_Show = "Premium";
}else if($avatar_name == "friday_13th"){
$a_Show = "Friday the 13th";
}else if($avatar_name == "pibab"){
$a_Show = "Pibab Cool";
}else if($avatar_name == "poo_stinky"){
$a_Show = "Poo Stinky";
}else if($avatar_name == "inky"){
$a_Show = "Inky";
}else if($avatar_name == "hayyou"){
$a_Show = "Hay You";
}else if($avatar_name == "hallo"){
$a_Show = "Cackle";
}else if($avatar_name == "brick"){
$a_Show = "Brickie";
}else if($avatar_name == "fishie"){
$a_Show = "Fish Bubbles";
}else if($avatar_name == "xmas2"){
$a_Show = "Mumbly Xmas";
}else if($avatar_name == "xmas"){
$a_Show = "Merry Christmas";
}else if($avatar_name == "spacey"){
$a_Show = "Spacey";
}else if($avatar_name == "donut"){
$a_Show = "I Love Donuts";
}else if($avatar_name == "darkemo"){
$a_Show = "The Dark Emo";
}else if($avatar_name == "xited"){
$a_Show = "Xited";
}else if($avatar_name == "888"){
$a_Show = "888";
}else if($avatar_name == "rings"){
$a_Show = "Olympic Rings";
}else if($avatar_name == "boo"){
$a_Show = "Boo";
}else if($avatar_name == "candycorn"){
$a_Show = "Candy Corn";
}else if($avatar_name == "tot"){
$a_Show = "Trick or Treat";
}
			}



echo "<option value=\"$avatar_name\">$a_Show</option>";

?>
</select>

Link to comment
Share on other sites

that is kind of weird it must be something with the loop because i used fetch function which grabs the query and uses mysql_fetch_array() to loop it. however i need to know what is going on with the loop if it is being called properly  or if the else if() {} statements are failing. ???

Link to comment
Share on other sites

You should use an array to simplify your code and to make it easier to add values -

<?php
$lookup = array();
$lookup["staff_m"] = "Staff: Male";
$lookup['"staff_f"] = "Staff: Female";
.... the rest of the key/value pairs

if(exists($lookup[$avatar_name])){
    $a_Show = $lookup[$avatar_name];
} else {
    // $avatar_name does not exist in the lookup table
    $a_Show = "";
}
?>

 

Edit for your last post, you should be learning, developing, and debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON so that you have immediate feedback of problems like no connections to databases and other detectable errors.

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.