PHPBuilder - Month Mine



RSS Twitter
Snippets Algorithms

Month Mine

by: Leonard Burton
|
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 lbburt0@pop.uky.edu. 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 lbburt0@pop.uky.edu.  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;
}

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Leonard Burton

Comment:



Comment:

(Maximum characters: 1200). You have characters left.