Jump to content

PHP working with JS


Recommended Posts

Hi,

 

Im working with an existing site for a friend at the moment and I've come across a bit of a problem, I need to pass an array value to a javascript file which I'm unsure of how to do, my php is...

 

$rs = mysql_query("select users.id, twitterUser, coff from users where twitterUser != '' and  
                users.id IN (select concat_ws(',', id) from users where id != ".$usersClass->userID().") and users.id NOT IN (select concat_ws(',', followedID) from activity where followerID = '".$usersClass->userID()."') and users.id NOT IN (select concat_ws(',', userid) from featured) ORDER BY credits DESC;") or die(mysql_error());    

$nr = @mysql_num_rows($rs);

if($nr != 0) {
    
    
    while($row=@mysql_fetch_object($rs))
    {
        $divLeft = '<div class="user-box"><div class="twithandlepic"><img src="http://api.twitter.com/1/users/profile_image/';
        $divRight = '<div class="twithandle">';
        $clearDiv = '<div style="clear:both;"></div>';



    print $divLeft.strip_tags($row->twitterUser)."?size=normal\"/><br \/>".$row->twitterUser.$divRight."<a href='javascript:void(0);' id='vote_$row->id' class='getPoint'>Get " .$row->coff. " credit(s)</a><br /></div>$clearDiv</div></div>"; 


}

 

Now I have a function in my javascript which is carried out after an onClick event...

 

  newbalance = newbalance+1;

 

What I need to do is somehow write "newbalance = newbalance+$row->coff;"

 

Does this make sense?

Link to comment
https://forums.phpfreaks.com/topic/237149-php-working-with-js/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.