I retrieved all of my friends' names which are currently online using MySQL joins and PHP.
Now I want to insert their names inside JavaScript for chatting with them.
<a href="javascript:void(0)" onclick="javascript:chatWith('Friend1')">Friend1 </a>
<a href="javascript:void(0)" onclick="javascript:chatWith('Friend2')">Friend2 </a>
I am unable to do this. Because I don't know how to call JavaScript inside PHP or viceversa.
while($get_usernames=mysql_fetch_array($get_users_query)) {
echo '<br>'.$get_usernames['username'];
}
I want to show each of $get_usernames['username'] as Friend1, Friend2, inside JavaScript