I'm quite used to work with Oracle Reports to build PDF reports and I'm looking for an equivalent tool/library for PHP.
Oracle Reports allows to rapidly position fields on a page, make tables based on loops, display headers on each page, insert graphics...
It's mainly based on a SQL query, but for what I'm looking for, I just like to have the simplicity of the features described before (and maybe more like charts).
I've used JasperReports in Java but I think it's not the right tool for this job, any suggestion (a free tool would be better) ?
Not sure if it's anything like Oracle Reports, but for building PDF reports, I'd recommend LiveDocx.
Related
I have to implement a reporting/statistic tool in php for one of my application. The amount of data is really huge, about 120 million records. The reports should be generated real time since the user can select many filters before generating a report, so no way to pre-generate it, let say on nightly bases.
The MySql database I use, can't handle this amount of data due the data aggregation and joins (for filtering). Even after trying to denormalize the tables it is really slow.
My question is there are any dedicated open source reporting statistics tool that I can use it from PHP? Even if it is not written in PHP but can be linked with a library.
I also read about non-sql databases but since they are not relational is really hard to do the joins on them and when comes to aggregation they are not really good (as far as I saw on mongoDB).
Thank you for your advice.
Best regards,
Feri
If you look for an open source reporting engine, Jasper Reports and Pentaho are the way to go, however, both run on Java and are better used loosely coupled (simply as Report Servers). There is an (partial) implementation of Jasper Reports in PHP called PHPJasperXML, depending of what you want, it may be worth to take a look at this project and use it.
Sorry if this question might sound stupid to you guys, but am total newbie to programming, apart from knowing SQL, the thing is i have been given a MYSQL database containing various information about kids diseases and a web interface written in php to create reports from the database that can be accessed via the interface. there are almost 25 different variables that need to be computed in the report, i have written sql queries to compute all these values, but i don't know anything about PHP, if i have all these queries isn't there a way for me to combine all these sql queries to be display results on a webpage and come up with this report without writing PHP code?
Thanks for your
again very sorry if this is too basic.
As mr_jp suggests, phpmysqladmin provides a simple front end for running queries, but also changing the data and modifying the schema. Although you can restrict named users to only have SELECT privilege, they'll still need to know SQL to run the queries.
It's not that hard to build a front end to take a set of parameters, substitute them into a SELECT statement and send the output to a formatted table. There are lots of datagrid tools (e.g. phplens, phpgrid, have a google for 'mysql datagrid' for more) which will handle the formatting of a MySQL resultset (or just download it as CSV - your browser should be able to transfer the data into your spreadsheet program automatically).
There are a couple of report generators for PHP - but the last time I looked at this in any depth, I wasn't overly impressed.
Your web host would probably have phpmyadmin installed. Try getting access from the web host.
You can enter your queries there and export the results as html, csv, excel and others.
You could write Python. Or Ruby. Or something you know. ;-)
But you need something to output your queried data.
If you just want to check the results by yourself without having the needs to publish that directly, you might use some MySQL query browser or administrator like phpMyAdmin or the MySQL Workbench. Those tools allow you to query the database but display the returned data only as raw tables. If you need some styling or your own layout, you'll have to use an own application or edit the exported data manually (e.g. using a CSV export and re-open it using some spreadsheet application like Excel or Calc).
The combination PHP + MySQL is a very popular one and it's highly recommended that you use them together.
The code that you will need to write in order to display that information using PHP is pretty straightforward and not very hard. If you do know some basic programming concepts, you can learn to do that in a matter of hours. PHP is well known for its extremely accessible learning curve. There are thousands of code samples online that you can look at to see how this is done.
Is it preferred to create tables in mysql using a third party application (phpmyadmin, TOAD, etc...) instead of php?
The end result is the same, I was just wondering if one way is protocol.
No, there isn't a 'set-in-stone' program to manage your database and query to it.
However, I highly recommend MySQL Workbench.
It allows you to graphically design your database, query to your database server and do all kinds of administration tasks.
I'd say it is far easier to do so within an application created for that purpose. The database itself obviously doesn't care as it's just DDL to it. Using Toad or PHP MyAdmin would help you do the job quicker and allow you to catch syntax errors prior to execution or use a wizard where you're not writing it by hand in the first place.
usually a software project provides one or more text files containing the ddl statements to create the necessary tables. what tool you use to execute those statements doesn't really matter. some php projects alwo provide a installer wizard php file which can be executed directly in the browser, so you don't need any additional tools at all.
I'll try to only answer what your question is - "Is it preferred to create tables in mysql using a third party application (phpmyadmin, TOAD, etc...) instead of php?"...
Yes, it is preferred to create tables or alter them or delete them or perhaps do any DB-related activity that is outside the scope of what interfaces your application provides, in MySQL using any of the many available MySQL clients. And the reason is because these applications are designed to perform DB related tasks and are best at doing them.
Though you may as well use PHP for creating tables depending on the situations, like if the application uses dynamic tables or needs "temporary" tables for performing complex jobs or storing intermediary results/calculations. Or perhaps if the application provides interfaces to manage/control certain aspects, like assume that a certain application consists of various user-roles that have their respective columns in the table. If the application provides rights to the admin to delete or add new roles, which will need to delete or add new columns, it's best to do such queries from PHP.
So, putting it again, use MySQL for any DB work that is not related or affected by what functionality or interfaces your PHP code provides.
Sidenote: Though I've used phpMyAdmin, TOAD, WorkBench and a few others, I think nothing's as efficient and quick as the MySQL client itself, i.e. working directly on the MySQL prompt. If you've always used GUI clients, you might find it unattractive to work on the prompt initially but it's real fun and helps you keep syntaxes on your tips :-)
You question might have been misunderstood by some people.
Charles Sprayberry was saying there's no best practice as far as which 3rd party MySQL client (i.e. phpmyadmin, TOAD, etc.) to use to edit your database. It comes down to personal preference.
Abhay was saying (and I really think this was the answer to your question), that typically, your application does not do DDL (although exceptions exist). Rather, your application will usually be performing DML commands only.
DML is Data Manipulation Language. For example:
select
insert
update
delete
DDL is Data Definition Language. For example:
create table
alter table
drop table
Basic SQL statements: DDL and DML
A db with several hundred tables will usually have more then few enums/sets defined in it.
How do you synchronize you PHP code with the enum values, to avoid using string literals in your code (which we all know it just seems easier, but in the long run causes stupid bugs).
The only good solution I can think of is using, during the build of the project, a process which will generate constants for all the enums in the DB, or, create and compile a PHP extension with those values.
Any different, better solutions out there?
As Plato would say: either PHP and SQL are independent, or SQL is generated from PHP, or PHP is generated from SQL, or both are generated from the same source.
The first is usually unacceptable if there's a lot of changes happening, but otherwise quite stable.
The second is what happens with a lof of recent solutions that manage your SQL from the PHP side (and gracefully handle schema changes from the PHP side as well). This means your mad SQL ninja skills might be useless and frustrating.
The third is what you suggest. It's fine as long as you can manage the "generated during build" part without stepping on the toes of your source control system and your package system. Having a clean build system helps (which is somewhat unusual in PHP).
The fourth involves adapting an existing database modeling tool to generate both the SQL schema and the PHP code. This way, you would simply work with the tool once every two weeks, generate both PHP and SQL, and commit the result. Adapting the tool, however, can be quite nasty (then again, you can try to look for an XML export and work from there).
I have thousands of photos on my site (each with a numeric PhotoID) and I have EXIF data (photos can have different EXIF tags as well).
I want to be able to store the data effectively and search it.
Some photos have more EXIF data than others, some have the same, so on..
Basically, I want to be able to query say 'Select all photos that have a GPS location' or 'All photos with a specific camera'
I can't use MySQL (it won't scale well with the massive data size). I thought about Cassandra, but I don't think it lets me query on fields. I looked at SimpleDB, but I would rather: not pay for the system, and I want to be able to run more advanced queries on the data.
Also, I use PHP and Linux, so it would be awesome if it could interface nicely to PHP.
Edit: I would prefer to stick with some form of NoSQL database.
Any ideas?
I also doubt that MySql would have any load problems, but have a look at CouchDB:
Apache CouchDB is a distributed, fault-tolerant and schema-free document-oriented database accessible via a RESTful HTTP/JSON API.
Getting started with PHP and the CouchDB API.
CouchDB: The Definitive Guide
CouchDB basics for PHP developers
I would probably personally stick to MySQL, but if you are looking for a NoSQL style system you might want to look into Solr. That allows things like faceted searches (e.g. tells you how many of your current search result fit into each resolution / format / etc and lets you narrow your search that way).