foreach ($this->showonline as $key => $friend) {
  • $friend['avatar']; $friend['name'];
  • }" />
      foreach ($this->showonline as $key => $friend) {
    • $friend['avatar']; $friend['name'];
    • }" />
        foreach ($this->showonline as $key => $friend) {
      • $friend['avatar']; $friend['name'];
      • }"/>
        DEVHIDE
        • Home (current)
        • About
        • Contact
        • Cookie
        • Home (current)
        • About
        • Contact
        • Cookie
        • Disclaimer
        • Privacy
        • TOS
        Login Or Sign up

        auto update online user list when new userlogin

        331 Views Asked by Bhashana Ranathunga At 12 November 2014 at 17:10 2025-12-18T16:00:02.857000
        <?php        
        <div class="someclass">
            <ul class="someclass">
                foreach ($this->showonline as $key => $friend) {
                <li>
                    $friend['avatar'];
                    $friend['name'];
                </li>
                }
        
            </ul>
        </div>
        ?>
        

        exmple :-

        1. model.php
        2. class.php
        3. hook.php
        4. index.phtml

        with model i get database information. with class im calculating online friend list as a array using array_intersect. and with hook i render to index.phtml. in phtml i use foreach loop and get the result to my online friendlist.

        Here is my function im getting online user list with this. but if new user come to online i must refresh the page to see new online member. i want to make it auto update list. with ajax or something. can someone give me example how can i do that?

        php jquery ajax livechat
        Original Q&A
        2

        There are 2 best solutions below

        1
        Ashique C M Ashique C M On 12 November 2014 at 17:29 BEST ANSWER

        You may use setTimeout function, either to reload the page or to call ajax and update the page content. here is small idea.

        setTimeout(function(){
        // Do code here for reload/ajax here.
        }, 3000);
        
        0
        Zz'Rot Zz'Rot On 12 November 2014 at 17:15

        I believe the problem is more involved than merely front-end.

        You will need the client to establish a socket with your server such that your server is able to constantly inform users of new online users. Otherwise, using a stay-alive connection with the server can also help, and use some jQuery to handle user list updates.

        Related Questions in PHP

        • php Variable name must change in for loop
        • register_shutdown_function is not getting called
        • Query returning zero rows despite entries existing
        • Retrieving *number* pages by page id
        • Automatically closing tags in form input?
        • How to resize images with PHP PARSE SDK
        • how to send email from localhost using codeigniter?
        • Mariadb max Error while sending QUERY packet PID
        • Multiusers login redirect different page in php
        • Imaginary folder when I use "DirectoryIterator" in PHP?
        • CodeIgniter + XDebug: debug only working in the main controller, index() function
        • PHP script timeout when I use sleep()
        • posting javascript populated form to another php page
        • AJAX PHP - Reload div after submit
        • PHP : How can I check Array in array?

        Related Questions in JQUERY

        • How to sort these using Javascript or Jquery Most effectively
        • Ajax jQuery firing multiple time display event for the same result
        • .hover() seems to overwrite .click()
        • Check for numeric value with optional commas javascript
        • Extending Highmaps Side Effect
        • Array appending after each onclick and loop in javascript
        • how can i append part of a table based on how many tr it has?
        • Play multiple audio files in a slider
        • Remove added set of rows
        • Access property of an object of type [Model] in JQuery
        • AJAX PHP - Reload div after submit
        • proengsoft/laravel-jsvalidation ReferenceError: jQuery is not defined
        • when a checkbox is checked how to display a different hidden element using javascript
        • Get jquery error Uncaught RangeError: Maximum call stack size exceeded
        • Removing only the closest thead on table filtering

        Related Questions in AJAX

        • Ajax jQuery firing multiple time display event for the same result
        • Implement Onfailure in webApi controller
        • AJAX PHP - Reload div after submit
        • ajax load data from mysql
        • Ajax-update only a component attribute, not the whole component nor its children
        • using ajax to get a php database result and then show the result in a button
        • How to prevent browser from executing some JavaScript when person clicks Back button?
        • ajax async: true statement execution order
        • Rails 4.2 jQuery loads only after refresh
        • WebForms GET Json requests (JsonRequestBehavior.AllowGet)
        • Rails - Ajax do not work properly on production server
        • Angular js Button click
        • Make jQuery/AJAX perform instantly on page load
        • jQuery Ajax Uncaught TypeError: Cannot use 'in' operator to search
        • Show success or error messages in Ajax response to Wordpress custom registration form

        Related Questions in LIVECHAT

        • automatic login to another website
        • How to set Muc Room Image Using XMPP in iOS
        • auto update online user list when new userlogin
        • How Can I open websocket port on azure?
        • How to receive Webhook and send message through Twillio with it's data
        • Android application for text and voice communication between devices on a same LAN
        • Develop a Instance Messaging Client + Server for Android
        • Getting socket.io response in android client, but can't understand how to implement the response in recycler adapter
        • socket.io net::ERR_CONNECTION_TIMED_OUT error
        • node.js server wont listen to the port or server blocks the connections to this port
        • How can we integrate Salesforce livechat sessions with a hybrid app (similar to an ionic app)?
        • How can I send message to particular subscriber in a bradcast list using firebase?
        • How can I integrate "chat" into an ASP.NET MVC site?
        • Chat App with php, Jquery
        • Olark like software in node.js needed

        Trending Questions

        • UIImageView Frame Doesn't Reflect Constraints
        • Is it possible to use adb commands to click on a view by finding its ID?
        • How to create a new web character symbol recognizable by html/javascript?
        • Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
        • Heap Gives Page Fault
        • Connect ffmpeg to Visual Studio 2008
        • Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
        • How to avoid default initialization of objects in std::vector?
        • second argument of the command line arguments in a format other than char** argv or char* argv[]
        • How to improve efficiency of algorithm which generates next lexicographic permutation?
        • Navigating to the another actvity app getting crash in android
        • How to read the particular message format in android and store in sqlite database?
        • Resetting inventory status after order is cancelled
        • Efficiently compute powers of X in SSE/AVX
        • Insert into an external database using ajax and php : POST 500 (Internal Server Error)

        Popular # Hahtags

        javascript python java c# php android html jquery c++ css ios sql mysql r reactjs

        Popular Questions

        • How do I undo the most recent local commits in Git?
        • How can I remove a specific item from an array in JavaScript?
        • How do I delete a Git branch locally and remotely?
        • Find all files containing a specific text (string) on Linux?
        • How do I revert a Git repository to a previous commit?
        • How do I create an HTML button that acts like a link?
        • How do I check out a remote Git branch?
        • How do I force "git pull" to overwrite local files?
        • How do I list all files of a directory?
        • How to check whether a string contains a substring in JavaScript?
        • How do I redirect to another webpage?
        • How can I iterate over rows in a Pandas DataFrame?
        • How do I convert a String to an int in Java?
        • Does Python have a string 'contains' substring method?
        • How do I check if a string contains a specific word?
        .

        Copyright © 2021 Jogjafile Inc.

        • Disclaimer
        • Privacy
        • TOS
        • Homegardensmart
        • Math
        • Aftereffectstemplates