onlyican Posted September 26, 2006 Share Posted September 26, 2006 HeyThis is a mix of php, MySQL, and Javascript I have downloaded a chat roomThey have a function that allowes you to add links to the username in the chat roomThe example they give is something like this[code] pfcClient.prototype.updateNickList = function(lst){ this.nicklist = lst; var nicks = lst; var nickdiv = this.el_online; var ul = document.createElement('ul'); for (var i=0; i<nicks.length; i++) { var li = document.createElement('li'); var a = document.createElement('a'); a.setAttribute('href','http://www.google.com/search?q='+nicks[i]); a.setAttribute('target','_blank'); a.setAttribute('class', '<?php echo $prefix; ?>nickmarker <?php echo $prefix; ?>nick_'+ hex_md5(nicks[i])); var txt = document.createTextNode(nicks[i]); a.appendChild(txt); li.appendChild(a); ul.appendChild(li); } var fc = nickdiv.firstChild; if (fc) nickdiv.replaceChild(ul,fc); else nickdiv.appendChild(ul,fc); this.colorizeNicks(nickdiv);}[/code]This is Javascript a guessTHe array "nicks" is what is holding the usernames, I dont know Javascript that wellBut I am guessing it loops through the usernames, from the for loop(Dont they have foreach in javascript)AnywayWhat I want to do is grab the usernameRun a MySQL query to select the idMaybe store the results in array calledid_nicksThen run my linkwith id_nicks there, not googleWhat I dont know how to do is parse the array nicks into phpthen parse the php array back into the javascriptunless I run a query per usernamewhich I dont want to doAny suggestions, comments ??? Link to comment https://forums.phpfreaks.com/topic/22158-parsing-around-the-world/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.