Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loading..Please Wait Dialog w/mySQL & PHP

Status
Not open for further replies.

estrellas

Programmer
Jul 16, 2004
48
0
0
US
hey guys -
i know that this topic has been posted here before, but i can't find it anywhere on the old forums.

my question is:

how do you do the "loading please wait"?

i have a huge database being displayed and I want to make a "Loading Please Wait" while the page is loading.

Code:
$query = "SELECT * from stations ORDER BY name";
	$result = mysql_query($query, $db);

		if (!$result) {
		echo mysql_error();
	}

That's the snippet I"m working with.

Also, how would i just dispay like 20 results at one time? and then have a "Next" button to display 20 more results?

Thanks much in advance guys :)
 
This question would probably better answered in the JavaScript forum.
To give you the jest:
You have a div tag that is visible and is switched to invisible via CSS attribute changes.
 
to limit the query

Code:
$offset = 0;
$display = 20;
if(isset($_POST['offset'])){  $offset = $_POST['offset']; }

$query = "SELECT * from stations ORDER BY name limit $offset, $display";

...
$offset += $display;  //increment the counter
echo "<input type='hidden' name='offset' value='$offset'>";

....

Limiting the query will likely reduce the need for a loading message.

You will likely also want the Previous button. Do the same thing but check which button is pressed to calc the offset.



Bastien

Cat, the other other white meat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top