Hey Anyone,
Is there a way in php (or HTML?) to display some kind of "LOADING..." message while waiting for the results of a mySQL query to be displayed?
(and then have the message dissapear after the table is displayed)
I've tried using LAYERS, but to no avail.
Any Ideas???
Thanks,
--Tim
Display message until database loads
Moderator: General Moderators
There is a package in PEAR that makes this kind of thing relatively easily.
http://pear.php.net/package/HTML_Progress
However, you can probably make the query fast enough by adding some indexing.
MySQL is really good at running SELECT statements.
For instance, I regularly run a query for 100 records at a time that joins 4 tables. two of the tables have MILLIONS of records.
on that same page I get counts from the same tables where the counts get up to 400,000.
That page loads just about as fast as every other page on the site (though I do have a dedicated database server).
-Jackson
http://pear.php.net/package/HTML_Progress
However, you can probably make the query fast enough by adding some indexing.
MySQL is really good at running SELECT statements.
For instance, I regularly run a query for 100 records at a time that joins 4 tables. two of the tables have MILLIONS of records.
on that same page I get counts from the same tables where the counts get up to 400,000.
That page loads just about as fast as every other page on the site (though I do have a dedicated database server).
-Jackson
paginating
Jackson,
Thanks for the reply.
I will follow the link you sent. However, I have Learned what I know of PHP on my own, and no NOTHING about PEAR.
I have tried a couple of "canned" paginating scripts found at hotscripts.com, but have found them to difficult to customize to my needs. (I use one, called PAGINATOR that works great until my query includes a WHERE statement, then it malfunctions and, again, due to my novice skills, I am unable to modify the script to correct the problem).
Any additional info you could provide (about using PEAR or other ways to paginate) would be greatly appreciated.
Thanks,
--Tim
Thanks for the reply.
I will follow the link you sent. However, I have Learned what I know of PHP on my own, and no NOTHING about PEAR.
I have tried a couple of "canned" paginating scripts found at hotscripts.com, but have found them to difficult to customize to my needs. (I use one, called PAGINATOR that works great until my query includes a WHERE statement, then it malfunctions and, again, due to my novice skills, I am unable to modify the script to correct the problem).
Any additional info you could provide (about using PEAR or other ways to paginate) would be greatly appreciated.
Thanks,
--Tim
Pagination Tutorial:
http://www.phpfreaks.com/tutorials/43/0.php
http://www.phpfreaks.com/tutorials/43/0.php
Pagination doesn't work with WHERE statements
DuFF,
I followed the tutorial you suggested. I seem to have the same problem No matter which way I do this.
The pagination works fine if I run a simple query like in the example. But I have a very complex query with multiple WHERE, LIKE AND SORT statements:
(I am passing these variables from a user form to narrow the search results)
As soon as I add in all these variables, the pagination no linger works.
I have now tried this with three different scripts for pagination.
If I leave out the pagination, my query works fine, but sometimes still returns hundreds of results, which take a while to disply.
Any Ideas???
--Tim
I followed the tutorial you suggested. I seem to have the same problem No matter which way I do this.
The pagination works fine if I run a simple query like in the example. But I have a very complex query with multiple WHERE, LIKE AND SORT statements:
Code: Select all
<?php
$result=mysql_query("SELECT * FROM VehicleList WHERE (PSAMID LIKE '%$Dealership%' AND Make LIKE '%$Make%' AND Model LIKE '%$Model%' AND Year >= '$YearLow' AND Year <= '$YearHigh' AND Price >= '$PriceLow' AND Price <= '$PriceHigh' AND BodyType LIKE '%$Body%') ORDER by '$Sort' ");
?>As soon as I add in all these variables, the pagination no linger works.
I have now tried this with three different scripts for pagination.
If I leave out the pagination, my query works fine, but sometimes still returns hundreds of results, which take a while to disply.
Any Ideas???
--Tim