#native_company# #native_desc#
#native_cta#

Month Mine

By Leonard Burton
on January 21, 2003

Version: 1.0

Type: Function

Category: Algorithms

License: Other

Description: This function Comes from The Function Junction at www.discountsexpress.com/PHPFJ and was created by Leonard Burton [email protected]. Unrestricted Release.

This function was created to mine dates from two distinct expense and income tables for a ledger application. It expexts a Ymd format in the date fields and returns a sorted array with the format of Ym.

function phpfj_mine_months()
{
		/*
This function Comes from The Function Junction at www.discountsexpress.com/PHPFJ and was created by Leonard Burton [email protected].  Unrestricted Release.

This function was created to mine dates from two distinct expense and income tables for a ledger application.  It expexts a Ymd format in the date fields and returns an array with the format of Ym.   


		*/


//Flow Control Variables
$i=0;
//Get Months 

$result[1]= mysql_query("select distinct left(date, 6) as date from ledger_expense");

$result[2]= mysql_query("select distinct left(date, 6) as date from ledger_income");

for ($a=1; $a < 3; $a++)
{
	if ($result[$a])
	{
		while ($row = mysql_fetch_array($result[$a]))
		{
			$i++;
			$months[$i]=$row["date"];
		}
		mysql_free_result($result[$a]);
	}
}
rsort($months);
return $months;
}