Display message until database loads

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tstimple
Forum Commoner
Posts: 53
Joined: Wed Jan 21, 2004 10:12 pm

Display message until database loads

Post by tstimple »

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
jaxn
Forum Commoner
Posts: 55
Joined: Fri Jan 16, 2004 1:50 pm
Location: Nashville, TN

Post by jaxn »

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
tstimple
Forum Commoner
Posts: 53
Joined: Wed Jan 21, 2004 10:12 pm

paginating

Post by tstimple »

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
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post by DuFF »

tstimple
Forum Commoner
Posts: 53
Joined: Wed Jan 21, 2004 10:12 pm

Pagination doesn't work with WHERE statements

Post by tstimple »

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:

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' ");

?>
(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
Post Reply