raymondm Posted April 5, 2007 Share Posted April 5, 2007 Hi guys, i'm trying to figure out how to do this. I want to be able to assign users an avatar based on their date of birth. To be a bit exact i want to be able to assign their zodiac sign to them if they fall within a date range... Then put a simple tag like {user.zodiac} to where the image is to show. Any ideas? Link to comment https://forums.phpfreaks.com/topic/45814-date-range-question/ Share on other sites More sharing options...
Caesar Posted April 5, 2007 Share Posted April 5, 2007 Should be easy enough if you store the dates as timestamps in your database. Then in your switch or if/else, you define the diferent signs they fall under based on the month/day criteria. Link to comment https://forums.phpfreaks.com/topic/45814-date-range-question/#findComment-222592 Share on other sites More sharing options...
$cripts Posted April 5, 2007 Share Posted April 5, 2007 long way... create on long if statement for it using an array for each element ( days ) for each sign and months Link to comment https://forums.phpfreaks.com/topic/45814-date-range-question/#findComment-222593 Share on other sites More sharing options...
Psycho Posted April 5, 2007 Share Posted April 5, 2007 You are asking for several differnt things in your question and you have not provided and details abut your current state: i.e. where you are storing the user info, are you already capturing the birth date, etc. If it were me, I would determine the correct zodiac sign at the time I am saving the user record and then save the zodiac name in a column in the user table. Then I would have the zodiac sign images saved in a specific folder according to their name, e.g. images/zodiac/scorpio.jpg" Then when displaying usre information on a page I would first query for the information and then display the zodiac image something like this: <img src="/images/zodiac/<?=$results[zodiac]?>.jpg" If you already have a page set up where you are displaying the user info, then it would be helpful if you posted or attached the current relevant code from that page and any included pages. Link to comment https://forums.phpfreaks.com/topic/45814-date-range-question/#findComment-222594 Share on other sites More sharing options...
PC Nerd Posted April 5, 2007 Share Posted April 5, 2007 um, could you simply store their dob. then int it, so that you can simply go if $dob % 12 + 1 == 1, then avatar = this; that way you wouldnt have to type in everyu poability.... glk Link to comment https://forums.phpfreaks.com/topic/45814-date-range-question/#findComment-222596 Share on other sites More sharing options...
raymondm Posted April 5, 2007 Author Share Posted April 5, 2007 ok, as it stands i have a mysql database that stores the DOB and groups people by signs in a row called "astrologic_sign" according to their sign example gemini. what i want is to use that info from that row to show an image on the users' page that will be their sign. i'm new to php so i got lost trying to figure out what to write. Link to comment https://forums.phpfreaks.com/topic/45814-date-range-question/#findComment-222602 Share on other sites More sharing options...
raymondm Posted April 6, 2007 Author Share Posted April 6, 2007 anyone? Link to comment https://forums.phpfreaks.com/topic/45814-date-range-question/#findComment-222906 Share on other sites More sharing options...
Psycho Posted April 7, 2007 Share Posted April 7, 2007 Show us the code that you are using on the user page. Link to comment https://forums.phpfreaks.com/topic/45814-date-range-question/#findComment-223374 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.