Gregg Posted September 8, 2006 Share Posted September 8, 2006 Ok, the feild i am trying to pull the info from has serveral values.It's on my results page, and it shows all the users matching there discription..(0) (1) Male(2) Female(3) Couple(4) Group(5) Couple FF(6) Couple MMAnd i can get it to work using this but it wont pull all the values.[code]<?if($rowuser["genderid"]%2==0)echo Female; elseecho Male;?>[/code] Link to comment https://forums.phpfreaks.com/topic/20145-not-defining-gender-from-db/ Share on other sites More sharing options...
robos99 Posted September 8, 2006 Share Posted September 8, 2006 What exactly is the problem you're having? Your list of values...are those just the possible values for your gender column in the DB? Or is that entire list in the gender column? Link to comment https://forums.phpfreaks.com/topic/20145-not-defining-gender-from-db/#findComment-88574 Share on other sites More sharing options...
mewhocorrupts Posted September 8, 2006 Share Posted September 8, 2006 [quote author=Gregg link=topic=107375.msg430767#msg430767 date=1157737546]Ok, the feild i am trying to pull the info from has serveral values.It's on my results page, and it shows all the users matching there discription..(0) (1) Male(2) Female(3) Couple(4) Group(5) Couple FF(6) Couple MMAnd i can get it to work using this but it wont pull all the values.[code]<?if($rowuser["genderid"]%2==0)echo Female; elseecho Male;?>[/code][/quote]I'm a little confused by the code you included in your post. Why would you use the modulus operator to determine if they are male or female? What if the "genderid" is "5" -- Couple FF -- the code you have would print Male. Link to comment https://forums.phpfreaks.com/topic/20145-not-defining-gender-from-db/#findComment-88601 Share on other sites More sharing options...
Barand Posted September 8, 2006 Share Posted September 8, 2006 Use an array[code]<?php$gender = array ( 1 => 'Male', 2 => 'Female', 3 => 'Couple', 4 => 'Group', 5 => 'Couple FF', 6 => 'Couple MM');echo $gender[$rowuser["genderid"]];?>[/code] Link to comment https://forums.phpfreaks.com/topic/20145-not-defining-gender-from-db/#findComment-88721 Share on other sites More sharing options...
Gregg Posted September 8, 2006 Author Share Posted September 8, 2006 Thanks "Barand" worked great!And sorry i posted this kind of confusing i was on the way out so needed to save it befor i left lol..I needed the right code to get all of the genders and the one posted worked when i inter graded it into the head code so thanks. :D Link to comment https://forums.phpfreaks.com/topic/20145-not-defining-gender-from-db/#findComment-88748 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.