PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
$link = connect(HOST, USER, PASSWORD);
$res = getContent($link, 500, 69);
if(!$_GET['time'])
$_GET['time'] = 0;
$aTemp = null;
while($row = mysql_fetch_array($res)){
//not sure what to do...they use a list format, I am not sure what javascript will recognize
}
Before we go any further, the Javascript uses the jquery library. You do have jquery on your site, don't you? It will typically be called by a <script></script> bit in the head section of the web page.
The refresh() function expects the script daddy-shoutbox.php to return a JSON object. You will need to have the functions json_encode and json_decode available in php. They are available by default from (I think) php 5.2.1. A google search for "json_encode php4" will throw up some libraries which simulate json_encode for earlier php versions.
If you want people to help you, you need to give your thread a better title. When people are browsing the forums, all they see is your thread title. How is somebody supposed to know if they can help you when all they have to go on is that you have a problem. I am not coming down on you, I just want you to know how to get help on these forums... specific (yet concise) thread titles are how you get help. So... update your title please.
1) sorry luke haha I will stop naming things stupid names, I was getting pretty frustrated last night/early morning, and wasn't thinking very straight.
Thanks a lot peter carter, that is some headway, of course I included jquery first off lol, but is json expecting an array? for example, say you have $row['user'], $row['message'], $_GET['time'], how do you make it match the list/explode/array format it gave? I'm sorry I am not quite getting it, but I am not really used to working with json, and still not sure why I need it for this.
2) I have a comment system using Jquery $post/ajax function which works just fine, but I simply want to fade comments in individually to enhance the user experience, and this dumb script does that. Is JSON necessary or could I just modify my post function?
k I tried this converted from the first post's code with no luck, I feel like I am getting closer though lol. When I echo the result in a test file I get just {"nickname":"fdfdf","message":"dfdf","time":"12"}, when I set the $_GET['time'] to 12, which is ok, but this does not even print all the results, and for some reason the javascript does not print anything when tested through the get json function.
k nvm it doesnt work lol, it refreshes the content 3-4 times before stopping, which makes me think it is because there is no for each statement, but I am not quite sure how to integrate one since there is already a while statement. Any ideas anyone lol?