theKiwi Posted April 27, 2006 Report Share Posted April 27, 2006 (edited) The following code will generate a list of people married on this day with their marriage year and names. The name is a link to their page. If you are not logged in it doesn't show the Living people.The lines that are currently commented out (after the lines at the head) I put there to suppress generating the list on New Year's day since anyone who had only a year for their date was assumed to be on 1 January, so the lists were impossibly long and the server load quite high. I don't now remember why they are commented out though.PS I've now added this file as an attachment.Roger<?//=====================================================// anniv.php - working copy// borrowed form the php-nuke 1.6 module// Authors: Jeff Grantham genealogy.kb5wck.com// Roger Moffat [url=http://roger.lisaandroger.com]http://roger.lisaandroger.com[/url]//=====================================================include_once("config.php");include_once("genlib.php");tng_db_connect($database_host, $database_name,$database_username,$database_password) or exit;//$today = date("m/d");//if ($today != "01/01") {if( $currentuser ) {$tngquery = @mysql_query("SELECT husband, wife, marrdatetr, gedcom, familyID FROM $families_table where DAYOFMONTH(marrdatetr) = DAYOFMONTH(CURDATE()) and MONTH(marrdatetr) = MONTH(CURDATE()) ORDER BY marrdatetr"); while( $dbrow = mysql_fetch_assoc( $tngquery ) ) { if( $dbrow[husband] && $dbrow[wife] ) { $tngqueryh = @mysql_query("SELECT lastname, firstname, personID, gedcom, living from $people_table where personID = \"$dbrow[husband]\" and gedcom = \"$dbrow[gedcom]\""); $foundh = mysql_num_rows( $tngqueryh ); if( $foundh == 1 ) $dbrowh = mysql_fetch_array( $tngqueryh ); $tngqueryw = @mysql_query("SELECT lastname, firstname, personID, living from $people_table where personID = \"$dbrow[wife]\" and gedcom = \"$dbrow[gedcom]\""); $foundw = mysql_num_rows( $tngqueryw ); if( $foundw == 1 ) $dbroww = mysql_fetch_array( $tngqueryw ); $content .= "<span class=\"smaller\"><a href=\"$cms[url]/familygroup.php?familyID=$dbrow[familyID]&tree=$dbrow[gedcom]\">"; $content .= "$dbrowh[firstname] $dbrowh[lastname] married "; $content .= "$dbroww[firstname] $dbroww[lastname]</a> - <i>" . substr( $dbrow[marrdatetr], 0, 4 ) ."</i></span><br>\n";} }echo $content; }else{$tngquery = @mysql_query("SELECT husband, wife, marrdatetr, gedcom, familyID FROM $families_table where DAYOFMONTH(marrdatetr) = DAYOFMONTH(CURDATE()) and MONTH(marrdatetr) = MONTH(CURDATE()) and living = 0 ORDER BY marrdatetr"); while( $dbrow = mysql_fetch_assoc( $tngquery ) ) { if( $dbrow[husband] && $dbrow[wife] ) { $tngqueryh = @mysql_query("SELECT lastname, firstname, personID, gedcom, living from $people_table where personID = \"$dbrow[husband]\" and gedcom = \"$dbrow[gedcom]\""); $foundh = mysql_num_rows( $tngqueryh ); if( $foundh == 1 ) $dbrowh = mysql_fetch_array( $tngqueryh ); $tngqueryw = @mysql_query("SELECT lastname, firstname, personID, living from $people_table where personID = \"$dbrow[wife]\" and gedcom = \"$dbrow[gedcom]\""); $foundw = mysql_num_rows( $tngqueryw ); if( $foundw == 1 ) $dbroww = mysql_fetch_array( $tngqueryw ); $content .= "<span class=\"smaller\"><a href=\"$cms[url]/familygroup.php?familyID=$dbrow[familyID]&tree=$dbrow[gedcom]\">"; $content .= "$dbrowh[firstname] $dbrowh[lastname] married "; $content .= "$dbroww[firstname] $dbroww[lastname]</a> - <i>" . substr( $dbrow[marrdatetr], 0, 4 ) ."</i></span><br>\n";} } echo $content; }//} else {// echo "<div align=\"center\"><span class=\"smaller\">Happy New Year.<br>No listings today.</span></div>"; // }?>todayanniversaries.php Edited April 29, 2006 by theKiwi Quote Link to comment Share on other sites More sharing options...
clweed Posted June 3, 2006 Report Share Posted June 3, 2006 Hi Roger,First off thanks for sharing the codes.I've downloaded and installed all 3 files(Birthday, Death, Anniversaries) the same way, todaybirthdays.php is the only one that returns results. Even though there is an anniversary today.Any Thoughts?Lee Quote Link to comment Share on other sites More sharing options...
theKiwi Posted June 3, 2006 Author Report Share Posted June 3, 2006 Are both of the people in the Anniversaries not living? If either of them is living then it will return no results.Roger Quote Link to comment Share on other sites More sharing options...
clweed Posted June 3, 2006 Report Share Posted June 3, 2006 Are both of the people in the Anniversaries not living? If either of them is living then it will return no results.RogerYes, they are living. Can the code be modified to show the living if the user has rights?Lee Quote Link to comment Share on other sites More sharing options...
theKiwi Posted June 4, 2006 Author Report Share Posted June 4, 2006 It already does that I think - the if( $currentuser ) { line in the code is checking for that - if you log in, then view the index page it should show it to you.Roger Quote Link to comment Share on other sites More sharing options...
beun.net Posted September 12, 2006 Report Share Posted September 12, 2006 Cool add-on Just now added it to my site.Thanks!But... I do have a question.If on a specific date there is no anniversary, the above PHP-file doesn't display anything.Would it be possible to have it state "No anniversaries today", or something like that, when there is no anniversary?That would rule. Quote Link to comment Share on other sites More sharing options...
theKiwi Posted September 12, 2006 Author Report Share Posted September 12, 2006 But... I do have a question.If on a specific date there is no anniversary, the above PHP-file doesn't display anything.Would it be possible to have it state "No anniversaries today", or something like that, when there is no anniversary?That would rule.OK - not that I really know what I'm doing, but after some trial and error I think it's working. See the attached file.If anyone has a better way of finding out if the result set is empty or not I'm all eyes.Rogertodayanniversaries.php Quote Link to comment Share on other sites More sharing options...
beun.net Posted September 12, 2006 Report Share Posted September 12, 2006 OK - not that I really know what I'm doing,Yeah, right but after some trial and error I think it's working. See the attached file.If anyone has a better way of finding out if the result set is empty or not I'm all eyes.RogerThanks man!I'm gonna check it now //edit: Seems to work like a charm. Thanks! Quote Link to comment Share on other sites More sharing options...
theKiwi Posted November 29, 2006 Author Report Share Posted November 29, 2006 Here's an updated file that works under PHP 5.2.0. The previous version started with<?which worked with PHP 4.x.x, but wouldn't work with PHP 5.2.0. This file starts with<?phpCheersRogertodayanniversaries.php Quote Link to comment Share on other sites More sharing options...
B McFadyen Posted November 30, 2006 Report Share Posted November 30, 2006 Here's an updated file that works under PHP 5.2.0. The previous version started with<?which worked with PHP 4.x.x, but wouldn't work with PHP 5.2.0. This file starts with<?phpCheersRogertodayanniversaries.phpI think you will find that the above issue is not a PHP version problem. This is simply a php configuration choice. The <? tag is the short open tag syntax.The short open tag can be configured to work in both of the versions mentioned above. Edit your php.ini file and set short_open_tags=onOf course, using the <?php is the more portable option to start with.Brian Quote Link to comment Share on other sites More sharing options...
theKiwi Posted November 30, 2006 Author Report Share Posted November 30, 2006 I think you will find that the above issue is not a PHP version problem. This is simply a php configuration choice. The <? tag is the short open tag syntax.The short open tag can be configured to work in both of the versions mentioned above. Edit your php.ini file and set short_open_tags=onOf course, using the <?php is the more portable option to start with.Thanks for the explanation Brian...I got a new php.ini file with the PHP 5.2.0 installation - the installer on Mac OS X put it in parallel with PHP 4.4.4, so I can without much trouble switch between the versions should the need ever arise.I just figured it had to be something with the new PHP, and when <? phpinfo(); ?> wouldn't work, I eventually tripped over the reason.As my php.ini file notes now that I've looked in there for this it's best to use <?php when you don't control the server yourself.CheersRoger Quote Link to comment Share on other sites More sharing options...
clarkkent93 Posted April 21, 2007 Report Share Posted April 21, 2007 Would it be possible to have the number of years right after the names and date? Example: John Doe & Bessie - 2005 (2) Quote Link to comment Share on other sites More sharing options...
Scattered Posted August 26, 2007 Report Share Posted August 26, 2007 Hi Roger,I just uploaded your Birthday, Anniversary and Deaths scripts. I love them on the front page of the website! I do have one question I'd like to see if you can implement into the Anniversaries script. Does someone who has been divorced still show up in the Anniversary script, or are they not shown? I've only had the script up a few days and haven't had a chance to see if they show up. It would be sensitive to people's feelings if a divorced couple doesn't show up, but I don't know how easy or difficult it would be to have that happen.Thanks for your time! Quote Link to comment Share on other sites More sharing options...
theKiwi Posted August 26, 2007 Author Report Share Posted August 26, 2007 This script only examines the date of the wedding, and nothing else. What happens to a couple after the wedding isn't considered by the script.Since that script isn't mine alone - it's based on someone else's work too, I don't entirely know what's happening and I don't know how hard it would be to check if the couple was divorced afterwards or not.The only hopeful thought is that someone who is in your database and divorced, wouldn't necessarily be very excited about looking at your site on the day the fateful marriage commenced <g>Roger Quote Link to comment Share on other sites More sharing options...
genfan Posted August 27, 2007 Report Share Posted August 27, 2007 Well I guess this would never happen on my site as I do not display information about living people...Besides the wedding event happend regardless of the outcome...It is a bit like trying to hide the fact that a child was born out of wedlock. The event happended regardless of the emotional attachment the event may have...I firmly believe in documenting as best I can the events that have taken place in my ancestors lives and it is when someone goes to great lengths to obfuscate these events that it make it difficult for me to uncover the real event and not the emotional cover-up or whitewash... Quote Link to comment Share on other sites More sharing options...
Scattered Posted August 28, 2007 Report Share Posted August 28, 2007 I wasn't trying "hide" anything. The divorced spouses still show up on an individual's page. I look upon the Anniversaries on my front page as a way to "celebrate" an anniversary, if you will, and wanted to be sensitive to those registered users (since a registered user can view the living's Anniversaries) who had a distasteful divorce. Plus, it all shows up anyway in Darren's anniversaries.php script for registered users.Anyway, I solved the problem myself with a little trial and error.There are 2 queries in the code that need a slight addition. I added the phrase and divdate = '' (2 single quotes) as you can see below. $tngquery = @mysql_query("SELECT husband, wife, marrdatetr, gedcom, familyID FROM $families_table where DAYOFMONTH(marrdatetr) = DAYOFMONTH(CURDATE()) and MONTH(marrdatetr) = MONTH(CURDATE()) and divdate = '' ORDER BY marrdatetr");Do the same on the other $tngquery (not the $tngqueryh or $tngqueryw). I use Legacy, so I am assuming other gen programs use the same "divdate". Check your Families table to find out. When I mark marriage status as Divorced in Legacy, a "Y" shows up in my TNG database under divdate, not status, in the Families table, while a marriage with no divorce noted the divdate is blank. I've not marked any marriages in Legacy with a status of Annulled, Separated, etc., so I don't know exactly where those get put in the database. Maybe they are what show up in the "status" field in the Families table. That's for someone else to figure out! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.