![]() |
Force Redirect by Database Query
I have this idea that requires a page to be refreshed or a pop-up to occur after a database query. I cannot think of any way possible to do it.
It will require some type of javascript because it requires some client-side programming. I need it some how to load a php page every second and check if the database has been updated. Almost like a chat within PHP without the refresh. So basically some how to have a javascript loop that will run a PHP file and some how cause a page to do an action (that's the easy part). I was thinking of making the javascript use an image of some type but use the PHP file as the image's source, but from there I'm stuck. Anyone have any idea how to do this? It maybe impossible but I just can't think of anything. Please give any feedback! |
http://dev.mysql.com/doc/mysql/en/sh...le-status.html
this might help |
That won't help at all. You would need some way to run that query to check that info. I don't think what I'm trying to do is possible! :( I think it will require a forced redirect.
|
I didnt understand all. But still im giving my idea.
Use http refresh tags in your HTML which is generated by PHP Script. HTML refresh tags can refresh the pages every few seconds, ands thereby loading the script again and again. <meta http-equiv="refresh" content="2;url=http://www.talkphp.com/"> This will refresh the page to talkphp.com every 2 seconds. |
That's the thing. I don't want the page to actually refresh. I was wondering if there was any way possible that you can use javascript to and return some type of value via a PHP script without loading a new page. I can do this using a refresh, but I'm trying to stay away from that.
Thanks for the help though! |
I am not too good at javascript :(
|
I know enough to get me into trouble but not enough to know if this is possible! :(
|
it should be able to do but will take a while and will be complicated
1. build a script to get the last modified date of a table and return it in the source 2. get a javascript function to call the script and place the value in a javascript variable 3. then build a javascript function to recall the above function and compare the newscript value to the variable. 4. if the values match do nothing, if they dont match go else where there are javascript functions about that can collect data from another page without the need to refresh the page im just not sure if you could do it with that your trying to do it would be alot easier if you place the values in a phpsession and refresh the page every so often |
The refresh is no problem if it\'s required, I was just trying to prevent it. What I had in mind was something along the lines as setting an image\'s source which would be 1px by 1px somewhere on the page so it would be hidden, but the source would be changed within a while loop or for loop. Once the image\'s source matches something that is returned by the php\'s script which is actually what the image\'s source is then it would force a pop-up window to open.
Very hard to explain. Again, no idea if it\'s possible and if it is, I have no idea how to go about it. :( |
You could do it with ASP. Because PHP is lame. haha. just kidding.
|
if you still looking for it, then i suggest you take a look at this page http://www.talkphp.com/online.php?or...e&pp=20&page=1.
look at the code, it has javascript, which refreshes the page after somet time. i think that's what you meant OR you can do it with CRON JOB ion UNIX or scheduling on Windows. hope this helps |
That's not exactly what I need. What I need would be something like what vBulletin will be releasing in their 3.5 version, the AJAX system.
That's exactly what I needed for this project, but now I have moved onto other projects. :( |
AJAX will be everyone's hero soon :)
|
| All times are GMT. The time now is 12:44 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0