Status
Not open for further replies.

ElitePirate

Active Member
136
2009
3
80
Hi


I have a report.php page where when i click a link, the sql statement will be executed and results will be exported to csv file.


To display the links (for example every monthly report)


[Jan report]
[Feb report]
[Mar report]


i use this code :


$lst_csv = array(
'List - Jan 2013'=>
array(
'table'=>'tbl_jan',
'where'=>"WHERE v_id=12",
'db'=>'main',
'select'=>'name,id'),

'List - Feb 2013'=>
array(
'table'=>'tbl_feb',
'where'=>"WHERE v_id=12",
'db'=>'main',
'select'=>'name,id'),


'List - Mar 2013'=>
array(
'table'=>'tbl_mar',
'where'=>"WHERE v_id=12",
'db'=>'main',
'select'=>'name,id'),


according to the current setup every month i need to add 1 portion for that month. Is there anyway i can add all 12 portion for all 12 months, but the array will display the link only if the current month is <= list month.


Lets say i list down the link for all 12 months in 2013. If i run the php now, it should display link for Jan 2013 only.


Any idea?


Thanks
 
3 comments
You really don't need to use and array to get the right query for the current month. You can use this

Code:
'query'=>
 array(
 'table'=>'tbl_'.strtolower(substr(date('F'),0,3)), 
 'where'=>"WHERE v_id=12",
 'db'=>'main',
 'select'=>'name,id');
 
Status
Not open for further replies.
Back
Top