LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   building database with automatic report sending (https://www.linuxquestions.org/questions/programming-9/building-database-with-automatic-report-sending-901908/)

sycamorex 09-08-2011 08:40 AM

building database with automatic report sending
 
Hi all,

I have started working for a small training provider. Apart from my tutor responsibilities, I help with the IT site. I was asked to look into a possibility of creating some database system. I know that what I'm going to describe can be done in PHP but my php skills are not that great (well, I know the basics only, LOL) so my question is whether you know of any product/ that would do the following:

1. Some tutors/assessors will input some student details on one of the subpages. The details of the form will be recorded in a database (this bit I could do myself)
2. Tutors/assessors should be able to view the database on one of the subpages (in a form of a table). Ideally there should be a possibility of exporting the table (and/or particular columns to an .xls file (I know, MS:( )
3. At the end of the week the system should produce a report, ie. send an email containing certain rows of the table (based on the value of one of the columns)

I hope it makes sense. I'd be more than happy to do it myself (especially that I'm slowly learning php) but the system should be up and running within 3-4 weeks and with my current php skills and lack of free time there's no way I could create a reliable and secure system within this timeframe. For that reason, I'd probably be looking at some ready-made solution out there.

thank you.

kasl33 09-09-2011 03:43 AM

Don't overthink the simplicit of this task. Do this:

Set up cron job as a user such as root

Code:

crontab -e
Create a program using Php (server program -not a web page) tha retrieves the results from the database when cron executes it. Once it retrieves the data, use Php's mail function.

The php functions for this are as follows:

Code:

mysql_query
mysql_fetch_array
mail

Name the page something like report.php and cron can execute the script as this:

Code:

php report.php (don't forget to put the * * *... for time intervals in cron - I'm on my phone so you'll have to lookup syntax

dugan 09-09-2011 08:38 AM

Quote:

Ideally there should be a possibility of exporting the table (and/or particular columns to an .xls file
Export to a CSV file, which Excel can load. A CSV is much easier to create programmatically.

BTW, PHP is not the only choice. There's also Python (Django) and Ruby (on Rails).

ta0kira 09-09-2011 08:54 AM

Quote:

Originally Posted by kasl_33 (Post 4467085)
The php functions for this are as follows:

Code:

mysql_query
mysql_fetch_array
mail


SQLite would be a simpler alternative since it doesn't require setting up a DBMS server.
Kevin Barry

AnanthaP 09-09-2011 09:17 AM

Please concentrate on validating the inputs since it will be used by others who dont know your thought process.

I would go with a sophisticated - free for production and not just development (but not open source) - DBMS (like Oracle Express or SQL Express) that allows back end validations and consistency checks in case your programme missed some checks, coupled with proven interfaces to PHP, and generic report writer and export options.

The learning curve is not steep and with these features, you should be able to hit the ground running.

If the mind balks at using billy boy's or bully boy's products, then mySql can be used but AFAIK, there is no free version.

OK

sycamorex 09-09-2011 03:19 PM

Thanks a lot for all your suggestions/advice.
It seems I'll probably have to create it after all. At least I'll learn something new, but no way I'm going to do it within 3 weeks. I've got other responsibilities at work as well.

kasl33 09-09-2011 03:33 PM

Quote:

Originally Posted by sycamorex (Post 4467644)
Thanks a lot for all your suggestions/advice.
It seems I'll probably have to create it after all. At least I'll learn something new, but no way I'm going to do it within 3 weeks. I've got other responsibilities at work as well.

Well let me know if you need any assistance with it if you decide to use Php and MySQL. Send me a PM if you want and from there, we can go by email.

ta0kira 09-09-2011 03:38 PM

Quote:

Originally Posted by AnanthaP (Post 4467354)
Please concentrate on validating the inputs since it will be used by others who dont know your thought process.

I would go with a sophisticated - free for production and not just development (but not open source) - DBMS (like Oracle Express or SQL Express) that allows back end validations and consistency checks in case your programme missed some checks, coupled with proven interfaces to PHP, and generic report writer and export options.

The learning curve is not steep and with these features, you should be able to hit the ground running.

If the mind balks at using billy boy's or bully boy's products, then mySql can be used but AFAIK, there is no free version.

OK

PostgreSQL is a decent FOSS DBMS. Why the bias against open-source DBMSes?
Kevin Barry

sycamorex 09-09-2011 03:41 PM

Thanks a lot for your offer of help. I do appreciate it and might need it soon:)

kasl33 09-09-2011 03:45 PM

Quote:

Originally Posted by ta0kira (Post 4467655)
PostgreSQL is a decent FOSS DBMS. Why the bias against open-source DBMSes?
Kevin Barry

I could probably help with PostgreSQL too - it's just I have always used MySQL (since about 2003 or 2004) and it's what I have stuck to. The reason for this is because, as I understand, PostgreSQL is difficult to set up with multiple virtual nameservers and those are what I always have set up on my servers.

Otherwise, pg_query, pg_fetch_array, etc are really no big deal.

AnanthaP 09-09-2011 07:36 PM

Quote:

Quote:
Originally Posted by AnanthaP
Please concentrate on validating the inputs since it will be used by others who dont know your thought process.

I would go with a sophisticated - free for production and not just development (but not open source) - DBMS (like Oracle Express or SQL Express) that allows back end validations and consistency checks in case your programme missed some checks, coupled with proven interfaces to PHP, and generic report writer and export options.

The learning curve is not steep and with these features, you should be able to hit the ground running.

If the mind balks at using billy boy's or bully boy's products, then mySql can be used but AFAIK, there is no free version.

OK
PostgreSQL is a decent FOSS DBMS. Why the bias against open-source DBMSes?
Kevin Barry
Oops sorry. No bias. Didn't think about Postgres.


All times are GMT -5. The time now is 11:37 AM.