Jump to content

PHP Pick a date + show results?


blondieUA

Recommended Posts

Hello guys!

 

I have some problem with creating the result page :(

 

I need to create a web-page for my college course in Computer Science. I decided to create a site about Horoscopes. So if a person picks the date, he will be taken to a page with the results for different Horoscopes, e.g. Chinese, Zodiac, Astrological. The problem is that they all have different results for different periods of time. How can I arrange it?

 

Like if some1 will pick a date 1 Jan 1981, than he will be a Rooster due to Japanese Horo, and a Capricorn for Zodiac horo. So there will be different results for the same date. I have results for different periods of times in txt files for all horoscopes and same with image results. How can I make this, so the person will proceed to a page where he will see his result in a form of a list: Image for Chinese horo, than the text; than image for Zodiac Hore and the text...

Please, give me some simple ideas, I am so lost and noone can help me :(

I am sorry for the language, :) I am not from English speaking country.

Link to comment
https://forums.phpfreaks.com/topic/181269-php-pick-a-date-show-results/
Share on other sites

What the heck? Here, have it! Make it work.

 

 

while ($row = mysql_fetch_array($select)) {

          $birthdate = $row["birthdate"];

$seperate_date = explode("/", $birthdate); //Seperate Bday into seperates and remove the /

$day = $seperate_date[0]; //Seperate Birth DAY

$month = $seperate_date[1]; //Seperate Birth MONTH

$year = $seperate_date[2]; //Seperate Birth YEAR

$day_count = strlen($day);

$month_count = strlen($month);

if($day_count==1){$day = sprintf("%02d", $day);}

if($month_count==1){$month = sprintf("%02d", $month);}

$chinese_format = "$year$month$day";  //Combine into format yyyymmdd

}

 

$lunar_file = "../java/year.txt"; #for ease only. Set it up as you want. alter the file at your peril!

$year = file($lunar_file); #puts file into array

      for($x=1;$x<count($year);$x++){ #loops through the array

        $data = explode("=", $year[$x]);

        $date = explode("|", $data[1]);

        if(isset($date[0]) AND isset($date[1])){#looks for two dates to match with or between

            if($chinese_format>=$date[0] AND $chinese_format<=$date[1]){

              $sign = $data[0]; #stores star-sign only. This is passed to chris' site

    }

    }

    }

    if(file_exists('http://horoscope.netfirms.com/horoscopes/new/'.$typo.'.php')){#check file exists AKA Chris-Critchlow.com

 

 

 

 

you'll also need this as a txt file

 

 

 

ox=19010219|19020207

ox=19130206|19140125

ox=19250125|19260212

ox=19370211|19380130

ox=19490129|19500216

ox=19610215|19620204

ox=19730203|19740122

ox=19850220|19860208

ox=19970207|19980127

rat=19000131|19010218

rat=19120218|19130205

rat=19240205|19250124

rat=19360124|19370210

rat=19480210|19490128

rat=19600128|19610214

rat=19720215|19730202

rat=19840202|19850219

rat=19960219|19970206

 

See how they are piped? You can work out the rest foe yourself. I might return with a new site but for now, enjoy!

 

Ray CC

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.