CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   JavaScript frameworks (http://www.codingforums.com/forumdisplay.php?f=62)
-   -   jQuery PHP While() with jQuery? it doesn't show second record! (http://www.codingforums.com/showthread.php?t=179853)

samoi 10-17-2009 06:11 AM

PHP While() with jQuery? it doesn't show second record!
 
Hello guys!

My idea is to pull private messages to the user using PHP from MySQL, then when the user click on <div> element, then it should fadeIn() the message for him.

Let's see it in action:

PHP Code:

<script type="text/javascript">
$(document).ready(function(){
    
    
    $("#subj").click(function(){
        $("#msgBox").css('display', 'inline').fadeIn(3000);    
        });
    }
});        
</script>

<?
// PHP code!
// query to get the messages!
$SQL mysql_query("SELECT * FROM msg WHERE to_id = '".$userid."' AND `read` = \"0\"")or die(mysql_error()); 


// loop and pull more msgs !
while($row mysql_fetch_array($SQL)){
        
// Only a function to get the username instead of user id! do not see it!
    
$sender sender($row["from_id"],$row["to_id"] );
        
// Out put format!
    
echo 'From: '.$sender[0].' |,| And To '.$row["to_id"].' |,| subject! is:';
        
        
// Subject here! look in it has span id of *SUBJ* !
    
echo '<span id="subj"><font color="red">'.$row["subj"].'</font></span>';

        
// The Private message!
    
echo '<span id="msgBox" style="display:none;">'.$row["msg"].'</span>';

}
?>

This couldn't work!

it only works with the *FIRST* record of private messages!
But doesn't with the second message!


Help would be appreciated! :)

Fumigator 10-17-2009 06:17 AM

You need to use an Ajax call or reload the page.

samoi 10-17-2009 06:51 AM

Quote:

Originally Posted by Fumigator (Post 877520)
You need to use an Ajax call or reload the page.


Can you please help me with it! I haven't ever deal with ajax call kind of thing!

:o


All times are GMT +1. The time now is 02:30 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.