Presenting tables from MySQL query results

wordpress

#1

Still Trying to figure out if WordPress is for me.

I have some php scripts that display results of MySQL queries in a table like: http://ykfp.org/php/lyletrap/tabletotalscss2012.php I hoped that WordPress could help me display data like this, because just when I got them working perfectly, IE8 was released, the results from my tables don’t look very good in the new browser. When can’t Microsoft just accept standard html?


#2

I asked me the same question with a project, and I think wordpress is too “old fashion” compare to others CMS (even if I like wordpress don’t mistake me). Have a look on all good CMS that can provide good database management (on your one click install). After it just my opinion.


#3

I tried out Concrete5 on a subdomain, and ran into the same problem as WordPress. http://www.concrete5.org/community/forums/customizing_c5/are-there-add-ons-to-help-display-records-retrieved-from-a-mysql/#604768 CMS people don’t seem what I’m talking about when I ask about dynamic pages. Am I out of step by trying to present tables of numbers?


#4

If your table doesn’t look ok in a particular browser, then the issue is most likely CSS, not the framework used to generate the table. Looking at your HTML, you have a lot of inline styles (align=“right”) and IE-specific CSS hacks. I would recommend stripping it all out and getting back to basics, but that’s just me.


#5

Try adding this to your functions file:

<?php if (strpos($_SERVER['HTTP_USER_AGENT'],"MSIE 8")) {  /* tricks IE 8 into behaving  **/ 
header("X-UA-Compatible: IE=7");} ?>

#6

Did you look at the source of the example? The X-UA-Compatible meta tag is already in the header.


#7

…well durn


#8

You’re right. I really don’t know what I’m doing. The project started simple, something I could manage, then came the feature creep from the customer. Add some more columns, a scroll bar on the right would be nice, how about totals at the bottom?, more columns please. I stole, borrowed, begged for help on these forums. Nothing to be proud of. Rather than clean up the code, I thought I’d find something in CMS that would make this easy, but I was surprised that there wasn’t.


#9

If all you want is to display a simple table, then you really don’t need a CMS. Of course, if you want to go that direction, any good CMS or app framework will have good default settings for displaying tabular data.

Perhaps if you could give an example of precisely what doesn’t look right in which browser, others may be able to offer specific suggestions.

Also, a quick search for “php class display tabular data” gives dozens of classes and other ready-made solutions which you may be able to adapt.


#10

It’s not just a table of numbers, it’s data returned from a MySQL query. It has a slider on the right, totals on the bottom. http://ykfp.org/php/lyletrap/tabletotalscss2012.php

With new IE releases, it used to be that a little bit of the numbers scrolling by used to be visible above the header line, but now I don’t see that anymore. Now I’m running IE 11.0.9600. But there is still a minor difference in that IE shows a little space at the bottom between the container and the totals line.

I’d like to work towards a system where the query parameters could be input by the user on a form to get customized set of data displayed or available for download, like http://www.cbr.washington.edu/dart/query/adult_daily but I don’t see how CMS can help me.


#11

It’s a table of numbers. It doesn’t matter where the data are stored. That’s why you should keep your model and view separate. You are conflating two different ideas. The only problem you are describing with IE has to do with the view, and specifically the styles applied to the view, i.e. CSS. MySQL is simply not related.

Adding query parameters is another issue as well, not related to the presentation issue you detailed at the beginning. For that, you’ll need a form, and you’ll need to sanitise and validate the input, then use that to filter the data, which, in the case of data stored in a database, will involve building a query incorporating those parameters.

A CMS on its own won’t help you. What you need to do is a bit of programming. A simple framework could help, and it would probably be easier to do that using a full-blown CMS. But that’s up to you.

I’ve just read your link to the Concrete5 forum and I have to agree with them. You need to do a little code. There’s nothing magical out there that’s going to just take your database and present it for you, unless you want to just let your users access it with phpMyAdmin or something. That being said, Yii does a great job of producing basic models, views, forms, and controllers based on an existing database. It can very easily get you very far along the way, but you’ll still need to do some work.


#12

Thanks. I’m taking a look at Yii, looks interesting.