Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.