Hello, I am only inches away from Finishing up my website until I had an Issue creating a simple chat system for my website, I've Searched all over the place and it seems that the ONLY way is to use AJAX ( I am a total newbie to Ajax ) Is there any way to create a simple Database Driven Chat with PHP/MySql/Javascript ? If yes, can you guide me with a simple code to start with ?... or better yet a tutorial. Thanks in advance, Kind Regards, Issa Shamoun.
If you want to use Ajax, which is pretty much the only way here, I, and not only I, recommend using Jquery (http://jquery.com/) which is a pretty neat javascript library. For a chat application I recommend using json to communicate. (Using the json_encode function in php) If you want to fetch a variable from php, this script will do $.POST("url/toscript.php", {"postvar1": "value","postvar2":"value","etc":"value"}, function(data){ //data is now the Json code, echoed by the php file. var variable = eval("("+data+")"); }); Code (markup): It really isn't that difficult.
dude, http://www.phpfreechat.net/ is opensource php chat application, download it and start learning from the code.
JSON is JavaScript Object Notation. A method of representing data. As far as AJAX, jQuery makes it trivial: $.ajax({ url: "serverside-code.php", context: document.body, success: function(){ //whatever you want done when the data returns from the server; } }); Code (markup): But as freelanceinphp said, there are many PHP chat apps you can find on the web.