Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-17-2009, 06:11 AM   PM User | #1
samoi
New Coder

 
Join Date: Oct 2008
Posts: 38
Thanks: 5
Thanked 0 Times in 0 Posts
samoi is an unknown quantity at this point
Macintosh 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!

Last edited by samoi; 10-17-2009 at 06:14 AM..
samoi is offline   Reply With Quote
Old 10-17-2009, 06:17 AM   PM User | #2
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
You need to use an Ajax call or reload the page.
__________________
Fumigator is offline   Reply With Quote
Old 10-17-2009, 06:51 AM   PM User | #3
samoi
New Coder

 
Join Date: Oct 2008
Posts: 38
Thanks: 5
Thanked 0 Times in 0 Posts
samoi is an unknown quantity at this point
Quote:
Originally Posted by Fumigator View Post
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!

samoi is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:53 AM.


Advertisement
Log in to turn off these ads.