Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    Senior Coder
    Join Date
    Oct 2008
    Location
    Long Beach
    Posts
    1,196
    Thanks
    36
    Thanked 164 Times in 164 Posts
    Thanks but nothing gets displayed, blank page.
    - What's a blank page? get_count.php? I can't help you with that one because I don't have access to your database - so I'd have no idea what you're doing wrong.

    If your comments id is inserted via PHP on load, then do so, I don't see the problem:
    Code:
    function updateCounter()
    	{
    	var my_xmlhttputil = new XML_HTTP_Util();
    	var handleCount = function(response)
    		{
    		document.getElementById("count").innerHTML = "Comment added ("+response.responseText+")";
    		}
    	my_xmlhttputil.sendRequest("get_count.php?id=<?php echo($_GET['id']) ?>",true,handleCount);
    	}
    Feel free to e-mail me if I forget to respond ;)
    ohsosexybrit@gmail.com

  2. Users who have thanked itsallkizza for this post:

    student101 (12-24-2008)

  3. #17
    Regular Coder student101's Avatar
    Join Date
    Nov 2007
    Posts
    634
    Thanks
    80
    Thanked 15 Times in 15 Posts
    I didn't know that you could add the PHP values directly into the jscript like that, pretty cool.

    Edit: It works once I add in the PHP

    Only thing; In IE7 it shows once in FireFox it shows all the time after a page refresh/reload.
    Any ideas there?
    Edit: FIXED!!! Changed GET to POST

    The code from the get_count.php is this;
    PHP Code:
    <?php
    $sql 
    "SELECT COUNT(*) AS count FROM comments WHERE id = '$_GET[id]'";
    $result mysql_query($sql);
    if(
    $result){
      
    $row mysql_fetch_row($result);
      
    $count $row[0];
      echo 
    $count;
    } else{
      echo 
    "Err";
    }
    ?>
    Edit:
    This is so unbelievable THANK YOU!!!
    WOW how cool is this!
    Last edited by student101; 12-24-2008 at 08:40 AM.
    Thanks for your support!
    Update MySQL with checkboxes | Tell A Friend | Delete MySQL with checkboxes

    Give thanks & resolve when done :thumbsup:

  4. #18
    Senior Coder
    Join Date
    Oct 2008
    Location
    Long Beach
    Posts
    1,196
    Thanks
    36
    Thanked 164 Times in 164 Posts
    Glad I could help
    Feel free to e-mail me if I forget to respond ;)
    ohsosexybrit@gmail.com


 
Page 2 of 2 FirstFirst 12

Posting Permissions

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