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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can i make a progress bar with charts gorw during a for loop

Status
Not open for further replies.

justride

Programmer
Jan 9, 2004
251
US
hi all,

i am new to php charts but can i make a progress bar during a for loop, i want to show the user the % of progress for a script during an installation i am doing. like say im adding 5000 records to a db, show percantage of completion without refreshing the page.

thanks
 
Your script runs on the server, your client waits (may be) on the other side of our planet. Client browser window is not your script console. So without some kind of client side scripting you can't communicate on-line between PHP script and client browser.
 
without refreshing ?? why ? You must only make it look that it doesn't refresh but you need refreshing. second of all you must know on the serverside how long the job is going to take otherwise you can't tell the progress in waiting time.

you can do it easily with an single color image of widh 1 and height 20 then set te newwidth with

time elapsed/totaltime *100=newwidth of image
 
hey all, sorry to sound silly. i know php is server side and thats why i mentioned php with jscript embeded. I dont want the page refreshing.

heres the deal, i have a for loop calculating percentage each time around.

for i=0 i<5000 ....

I insert records into a table, how can i make a prgress bar

Code:
for( $i = 0; $i < $TOTAL_LINK_RECORDS; $i ++ ) { 
  		
		$percentage = $i / $TOTAL_LINK_RECORDS;
...... code....

echo "<script> incrCount(".substr($percentage,2,2).")  //set bar to 50% </script>";
	}
something like that.

this doesnt work just right
heres the url

thanks
 
You can update data on a page without refreshing in the browser. This is the whole point of AJAX and online apps like
A couple years ago, I would probably do this with an iframe. I am still researching how this is done with AJAX and know little about it but think this may be the way you want to go.


laughs at me in Firefox and returns errors in MSIE.


- - I hope this helps - -
(Complain to someone else if it doesn't)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top