dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: How update this query at realtime with jqery/other?

  1. #1
    Join Date
    Apr 2017
    Posts
    3

    How update this query at realtime with jqery/other?

    How update this mysql_num_rows jquery without refresh page?

    PHP Code:
    <?php 
    $count1_online 
    $mysqli->query("SELECT * FROM `messages`");
    $online1_count $count1_online->num_rows;          
    ?>

    <font size="3" color="orange"><?php echo $online1_count?> messages</font>

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    21,928
    You could just have this in a PHP script:
    PHP Code:
    <?php
    // whatever you do to initialize your mysqli object here, then...

    $count1_online $mysqli->query("SELECT COUNT(*) AS message_count FROM `messages`");
    $result $count1_online->fetch_assoc();
    header('Content-Type: application/json');
    echo 
    json_encode($result);
    Then go ask one of the JavaScript gurus here what's the best way to call that PHP script however/whenever you want, and update the HTML content with the data returned by that AJAX request.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  3. #3
    Join Date
    Apr 2017
    Posts
    3
    Thank you. I posted new thread in Javascript.
    Greetings from Bulgaria.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles