BleepingComputer.com: Php refresh part of page

Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Php refresh part of page

#1 User is offline   KamakaZ 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 548
  • Joined: 26-August 08
  • Gender:Male
  • Location:Victoria

  Posted 29 May 2009 - 09:15 PM

Hi, i have this page http://202.45.110.174/social i have it so messages are stored in the database.

i want to have php check the number of rows when the page is loaded, then display the rows in descending order, wait 10 seconds, check to see if the number of rows has changed (if there are new messages) then have it either display a pop-up with javascript or refresh the <ul id="wall"></ul> bit...


is this even possible?

i got the code for the page from here
If I am helping you and don't reply in 24 hours please send me a PM

There's no place like 127.0.0.1
There are 10 types of people in the world, those that can read binary, and those who can't.

#2 User is offline   groovicus 

  • Hail Groovicus!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Moderator
  • Posts: 9,522
  • Joined: 05-June 04
  • Gender:Male
  • Location:Centerville, SD

Posted 30 May 2009 - 08:33 AM

Yes, it is possible. You need to store the number of messages within the user's session. If the number of threads change, then the server needs to push out the updated page.
"Take the risk of thinking for yourself, much more happiness, truth, beauty, and wisdom will come to you that way" - Christopher Hitchens

#3 User is offline   KamakaZ 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 548
  • Joined: 26-August 08
  • Gender:Male
  • Location:Victoria

Posted 30 May 2009 - 08:40 AM

how would i accomplish this?

i have been looking into javascript and AJAX combined with php. still is very very tricky and would love any help you could give!
If I am helping you and don't reply in 24 hours please send me a PM

There's no place like 127.0.0.1
There are 10 types of people in the world, those that can read binary, and those who can't.

#4 User is offline   groovicus 

  • Hail Groovicus!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Moderator
  • Posts: 9,522
  • Joined: 05-June 04
  • Gender:Male
  • Location:Centerville, SD

Posted 30 May 2009 - 11:52 AM

What I would recommend is looking at web pages that auto-update and figure out what they are doing. It is not something that anyone can sit down and tell you how to do in 3 minutes. Besides, this sort of functionality should not be part of the core features anyway. This should be considered an enhancement. Get the basic stuff working first.
"Take the risk of thinking for yourself, much more happiness, truth, beauty, and wisdom will come to you that way" - Christopher Hitchens

#5 User is offline   SteelSlasher 

  • Member
  • PipPip
  • Find Topics
  • Group: Members
  • Posts: 20
  • Joined: 02-January 09

Posted 08 June 2009 - 12:10 PM

just to help you anyway even though groovicus is right about it being an enhancement, to do it you could use an iframe with a page which loads the messages and in that page just put in a piece of javascript to refresh the page every 10 secs

#6 User is offline   JJ2K 

  • Forum Regular
  • PipPipPip
  • Find Topics
  • Group: Members
  • Posts: 162
  • Joined: 23-January 09

Posted 18 June 2009 - 12:46 PM

You could try looking at how Shoutboxes are created as it seems your using the same sort of functionality..

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users