Bluehost.com Web Hosting $6.95

RE: [PHP] php mysql live feed

This is a discussion on RE: [PHP] php mysql live feed within the PHP General forums, part of the PHP Programming Forums category; Todd I want to thank you. You sent me thinking in the right direction to resolving this issue. I now ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-21-2008
admin@buskirkgraphics.com
 
Posts: n/a
Default RE: [PHP] php mysql live feed

Todd

I want to thank you. You sent me thinking in the right direction to resolving this issue. I now have successfully created a live Pika Card status GUI using PHP, MYSQL, AJAX.

The key word in what you said was unique function. I was not thinking to write a function. I was looking for the quick solve (php MySQL loop or something stupid). Not only does this work flawless but it has surpassed all my expectations of the gui.

Todd thank you again for your suggestions and you helped me allot.












Nameless,

I see someone mentioned the setTimeout(function, milliseconds) function for
JavaScript. I would also like to point out that you can use
setInterval(function, milliseconds) in order to have an event repeat at a set
interval. For instance, let's say you had a page laid out like so:

---
<div id="blah">
Text here
</div>
---

You would want to add a script somewhere that would begin the interval in order
to update the div:

---
<script type="text/javascript">
function ajaxRequest()
{
// <insert postback code here>

document.getElementById("blah").innerHTML = ajax.responseText;
}

var t = setInterval("ajaxRequest()", 5000);
</script>
---

This assumes that your XmlHttpRequest object is named "ajax". Assigning the
interval to variable "t" ensures that you can clear the interval if you need to
(via "clearInterval(t);").

I suppose "innerText" can be used instead of "innerHTML", as well. I would
recommend using innerHTML only if you will be populating the div with HTML
code, however.

Hope this helps,


Todd Boyd
Web Programmer


> -----Original Message-----
> From: admin@buskirkgraphics.com [mailto:admin@buskirkgraphics.com]
> Sent: Tuesday, May 20, 2008 3:25 PM
> To: php-general@lists.php.net
> Subject: [php] php mysql live feed
>
> Okay before i pull more hair out...
>
> I am trying to use php to pull mysql data and refresh the mysql data
> every say 5 seconds for like a live display of the database without the
> screen reloading.
>
> I want the data to refresh but not the screen. Ajax seems to hate me
> because everything i have seen/read/tried is wrapped around ASP.NET or
> requires a user interaction to invoke the query.
>
> If you have example scripts or a good tutorial that actually works
> where you can open a php script and the data changes on the page as the
> database does and the screen does not refresh, and you don’t haveto
> onclick, onfocus, or onblur kind of thing. I would be in your debt
>
> Frustrated Rick
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

Reply With Quote
  #2 (permalink)  
Old 05-21-2008
tedd
 
Posts: n/a
Default RE: [PHP] php mysql live feed

Hi:

The following could be taken from MySQL just as well:

http://webbytedd.com/b/timed-php/

Cheers,

tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
Reply With Quote
Reply
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

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




All times are GMT +1. The time now is 05:27 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0