TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 04-15-2005, 04:33 AM   #1 (permalink)
The Acquainted
 
Join Date: Mar 2005
Posts: 177
Thanks: 0
CreativeLogic is on a distinguished road
Default 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!
CreativeLogic is offline  
Reply With Quote
Old 04-15-2005, 05:13 PM   #2 (permalink)
The Wanderer
 
Join Date: Apr 2005
Posts: 9
Thanks: 0
Adam is on a distinguished road
Default

http://dev.mysql.com/doc/mysql/en/sh...le-status.html
this might help
Adam is offline  
Reply With Quote
Old 04-15-2005, 06:28 PM   #3 (permalink)
The Acquainted
 
Join Date: Mar 2005
Posts: 177
Thanks: 0
CreativeLogic is on a distinguished road
Default

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.
CreativeLogic is offline  
Reply With Quote
Old 04-15-2005, 07:35 PM   #4 (permalink)
The Wanderer
 
Join Date: Apr 2005
Posts: 6
Thanks: 0
gigapromoters is on a distinguished road
Default

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.
gigapromoters is offline  
Reply With Quote
Old 04-15-2005, 07:41 PM   #5 (permalink)
The Acquainted
 
Join Date: Mar 2005
Posts: 177
Thanks: 0
CreativeLogic is on a distinguished road
Default

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!
CreativeLogic is offline  
Reply With Quote
Old 04-15-2005, 07:44 PM   #6 (permalink)
The Wanderer
 
Join Date: Apr 2005
Posts: 6
Thanks: 0
gigapromoters is on a distinguished road
Default

I am not too good at javascript :(
gigapromoters is offline  
Reply With Quote
Old 04-15-2005, 07:48 PM   #7 (permalink)
The Acquainted
 
Join Date: Mar 2005
Posts: 177
Thanks: 0
CreativeLogic is on a distinguished road
Default

I know enough to get me into trouble but not enough to know if this is possible! :(
CreativeLogic is offline  
Reply With Quote
Old 04-15-2005, 07:53 PM   #8 (permalink)
The Wanderer
 
Join Date: Apr 2005
Posts: 9
Thanks: 0
Adam is on a distinguished road
Default

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
Adam is offline  
Reply With Quote
Old 04-15-2005, 07:58 PM   #9 (permalink)
The Acquainted
 
Join Date: Mar 2005
Posts: 177
Thanks: 0
CreativeLogic is on a distinguished road
Default

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. :(
CreativeLogic is offline  
Reply With Quote
Old 05-08-2005, 02:06 AM   #10 (permalink)
The Wanderer
Newcomer 
 
Join Date: May 2005
Posts: 5
Thanks: 0
zeromancer is on a distinguished road
Default

You could do it with ASP. Because PHP is lame. haha. just kidding.
Send a message via AIM to zeromancer
zeromancer is offline  
Reply With Quote
Old 06-01-2005, 08:05 PM   #11 (permalink)
The Acquainted
 
Join Date: May 2005
Posts: 106
Thanks: 0
jaswinder_rana is on a distinguished road
Default

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
__________________
---------------------------
Errors = Improved Programming.
Portfolio
Send a message via MSN to jaswinder_rana
jaswinder_rana is offline  
Reply With Quote
Old 06-01-2005, 11:53 PM   #12 (permalink)
The Acquainted
 
Join Date: Mar 2005
Posts: 177
Thanks: 0
CreativeLogic is on a distinguished road
Default

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. :(
CreativeLogic is offline  
Reply With Quote
Old 07-21-2005, 07:58 AM   #13 (permalink)
The Contributor
 
Join Date: Jun 2005
Posts: 40
Thanks: 0
clenard is on a distinguished road
Default

AJAX will be everyone's hero soon :)
clenard is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 11:35 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design