Home : General : Internet Technologies :

General: Internet Technologies: PHP: Perplexing Issue: Astrological Signs: Edit Log

Here is the list of edits for this post
PHP: Perplexing Issue: Astrological Signs
Hi all,

I am working on adapting a VBulletin PHP code modification for inserting and updating astrological signs into one of my PHP websites.

The modification and discussion can be found here:

http://www.vbulletin.org/...wthread/t-12660.html

The codes I was using are:

Code:

if (($my_birth_day > 20 and $my_birth_month == 03) xor ($my_birth_day < 20 and $my_birth_month == 04)) { $insert_astroid = "1"; }
elseif (($my_birth_day > 19 and $my_birth_month == 04) xor ($my_birth_day < 21 and $my_birth_month == 05)) { $insert_astroid = "2"; }
elseif (($my_birth_day > 20 and $my_birth_month == 05) xor ($my_birth_day < 22 and $my_birth_month == 06)) { $insert_astroid = "3"; }elseif (($my_birth_day > 21 and $my_birth_month == 06) xor ($my_birth_day < 23 and $my_birth_month == 07)) { $insert_astroid = "4"; }
elseif (($my_birth_day > 22 and $my_birth_month == 07) xor ($my_birth_day < 23 and $my_birth_month == 08)) { $insert_astroid = "5"; }
elseif (($my_birth_day > 22 and $my_birth_month == 08) xor ($my_birth_day < 23 and $my_birth_month == 09)) { $insert_astroid = "6"; }
elseif (($my_birth_day > 22 and $my_birth_month == 09) xor ($my_birth_day < 24 and $my_birth_month == 10)) { $insert_astroid = "7"; }elseif (($my_birth_day > 23 and $my_birth_month == 10) xor ($my_birth_day < 22 and $my_birth_month == 11)) { $insert_astroid = "8"; }
elseif (($my_birth_day > 21 and $my_birth_month == 11) xor ($my_birth_day < 22 and $my_birth_month == 12)) { $insert_astroid = "9"; }
elseif (($my_birth_day > 21 and $my_birth_month == 12) xor ($my_birth_day < 20 and $my_birth_month == 01)) { $insert_astroid = "10"; }elseif (($my_birth_day > 19 and $my_birth_month == 01) xor ($my_birth_day < 19 and $my_birth_month == 02)) { $insert_astroid = "11"; }
elseif (($my_birth_day > 18 and $my_birth_month == 02) xor ($my_birth_day < 20 and $my_birth_month == 03)) { $insert_astroid = "12"; }
else {
if (($my_birth_day > 19 and $my_birth_month == 04) xor ($my_birth_day < 21 and $my_birth_month == 05)) { $insert_astroid = "2"; }
elseif (($my_birth_day > 20 and $my_birth_month == 05) xor ($my_birth_day < 22 and $my_birth_month == 06)) { $insert_astroid = "3"; }
elseif (($my_birth_day > 21 and $my_birth_month == 06) xor ($my_birth_day < 23 and $my_birth_month == 07)) { $insert_astroid = "4"; }
elseif (($my_birth_day > 22 and $my_birth_month == 07) xor ($my_birth_day < 23 and $my_birth_month == 08)) { $insert_astroid = "5"; }
elseif (($my_birth_day > 22 and $my_birth_month == 08) xor ($my_birth_day < 23 and $my_birth_month == 09)) { $insert_astroid = "6"; }
elseif (($my_birth_day > 22 and $my_birth_month == 09) xor ($my_birth_day < 24 and $my_birth_month == 10)) { $insert_astroid = "7"; }
elseif (($my_birth_day > 23 and $my_birth_month == 10) xor ($my_birth_day < 22 and $my_birth_month == 11)) { $insert_astroid = "8"; }elseif (($my_birth_day > 21 and $my_birth_month == 11) xor ($my_birth_day < 22 and $my_birth_month == 12)) { $insert_astroid = "9"; }
elseif (($my_birth_day > 21 and $my_birth_month == 12) xor ($my_birth_day < 20 and $my_birth_month == 01)) { $insert_astroid = "10"; }
elseif (($my_birth_day > 19 and $my_birth_month == 01) xor ($my_birth_day < 19 and $my_birth_month == 02)) { $insert_astroid = "11"; }
elseif (($my_birth_day > 18 and $my_birth_month == 02) xor ($my_birth_day < 20 and $my_birth_month == 03)) { $insert_astroid = "12"; }else { $insert_astroid = ""; )
}

However, I noticed quite a few bugs with it, including the incorrect algorithym in the days for most of the astrological signs.

So, I adjusted the codes to look like the following:

Code:
function getAstrologicalID($birthday, $birthmonth) {
if ($birthmonth == 01) {
if ($birthday <= 19) {
$insert_astroid = "10";
}
else {
$insert_astroid = "11";
}
}
elseif ($birthmonth == 02) {
if ($birthday <= 18) {
$insert_astroid = "11";
}
else {
$insert_astroid = "12";
}
}
elseif ($birthmonth == 03) {
if ($birthday <= 20) {
$insert_astroid = "12";
}
else {
$insert_astroid = "1";
}
}
elseif ($birthmonth == 04) {
if ($birthday <= 19) {
$insert_astroid = "1";
}
else {
$insert_astroid = "2";
}
}
elseif ($birthmonth == 05) {
if ($birthday <= 20) {
$insert_astroid = "2";
}
else {
$insert_astroid = "3";
}
}
elseif ($birthmonth == 06) {
if ($birthday <= 20) {
$insert_astroid = "3";
}
else {
$insert_astroid = "4";
}
}
elseif ($birthmonth == 07) {
if ($birthday <= 22) {
$insert_astroid = "4";
}
else {
$insert_astroid = "5";
}
}
elseif ($birthmonth == 08) {
if ($birthday <= 22) {
$insert_astroid = "5";
}
else {
$insert_astroid = "6";
}
}
elseif ($birthmonth == 09) {
if ($birthday <= 22) {
$insert_astroid = "6";
}
else {
$insert_astroid = "7";
}
}
elseif ($birthmonth == 10) {
if ($birthday <= 22) {
$insert_astroid = "7";
}
else {
$insert_astroid = "8";
}
}
elseif ($birthmonth == 11) {
if ($birthday <= 21) {
$insert_astroid = "8";
}
else {
$insert_astroid = "9";
}
}
elseif ($birthmonth == 12) {
if ($birthday <= 21) {
$insert_astroid = "9";
}
else {
$insert_astroid = "10";
}
}
else {
$insert_astroid = "NULL";
}
return $insert_astroid;
}

Now, with both versions of the codes, all astrological signs are inserted/updated correctly, with the EXCEPTION of the virgo sign (which is astroid 6). This was reported as a bug in the above VBulletin web page I linked, but no solution has been posted there.

I've looked at many PHP manual pages and also perused through quite a few pages at the PHPBuilder Community Forums and other discussion forums, searched Google as well.

There seems to be something quirky happening with the 08 value that is not comparing correctly with either set of the above codes...

I did add some de-bugging coding into the script I am working on and here is an example of what is outputted:

2108NULL

DAY|MONTH|ASTROID

So, it looks like the proper parameters are being passed, but not recognizing 08 within the codes written above.

Any advice or suggestions for fixing this problem would be greatly appreciated.

Thanks in advance.
========================================
Buh Bye!

Cheers,
Me

Last edited by:

Stealth: Sep 7, 2003, 12:50 PM

Edit Log: