Jump to content
MakeWebGames

Coly010

Members
  • Posts

    912
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by Coly010

  1. Ok i'll definitely be reseaechig websockets then
  2. that's the point though. I don't want to have to pay for it, i'll try shove it onto another server and see how that goes otherwise I plan on re-doing it. out of interest is procedural or OOP mysql in php faster?
  3. Like i said, I tried this before with php, mysql, and jquery. but the site is overly slow! It is quite literally unusable when tested online. when i test on my computer using xammp it works fine, but i think that might be down to the computer. I was thinking maybe, would HTML 5's new features help me along in this, in any way? Lucifer, no its for a separate project but I was thinking that if it was possible to get it working then it shouldn't be too hard to implement into any game.
  4. I would like to make an instant messaging script so to speak, where the users can talk "instantly" with their friends or so on. I tried doing this through php and jquery already, however the result was anything but instant. even trying to open a chat would cause the site to slow to a halt. I have no problems with the concept behind it all, what I am asking, though, is, what is the "fastest" language, or combination of languages i can use for this. I was looking around and saw stuff like ASP and VB, as well as the usual javascript, html, html5, jquery and such. the three main functions would be: start a chat chat box updates "instantly" when new message has been sent/received "automatic" notifications when someone adds the user/ starts a chat with the user/ sends the user a private message. store messages in a database or similar for referencing, and displaying Is it possible to do this without causing the site to slow to a halt, because it will be practically useless if there are 1000 people online and the language results in the site being unusable. I know about node.js but i havent fully looked into it. It seems really confusing even just to set up, never mind delve into. any help is much appreciated.
  5. Thanks sniko thats extremely helpful! And yeah i think i'll need to look into optimizing code as well as running node.js and using a fast server if i want the best outcomes.
  6. If I need to manually install things, I'm going to learn what I need etc, so if someone could point me to reference for them that would helpful, and I was told that Node.js was difficult to install, is there a documentation on it?
  7. I have a website which uses a lot of JQuery, a lot of JQuery. It has different sections of the page reloading constantly, so it is a bit intensive, however I need it to run smooth for everyone, it needs be really fast or the website becomes pointless. There is a lot of php and sql being run by the JQuery, both during the reloads and when specific actions are performed. There is not a lot of images, but when hovered they do change. What I'm looking for is speed and reliability. Anyone know any Web Hosts that could offer me this?
  8. is this is in the wrong thread? I would have expected this answer to be in the PDO the way forward? thread as you haven't mention OOP or Procedural mysqli :/
  9. That was the same as me, and now personally prefer OO because I've simply grown used to it, and you don't need to include your $c = mysqli_connect(); variable in every query you try to run whereas with OO you just use say $db->.
  10. Coly010

    24hr Challenge

    Good luck interested to see what you accomplish
  11. I have used both. I have even used a mix of both, which isnt the wisest of ideas. Have you used any of the two yourself?
  12. I'm not using a $db class from a game engine. I'm quite literally simply using: $db = new Mysqli($host, $user, $pass, $dbname); And all the functions that come with that. Drunk typing isn't so good for you rockwood.
  13. my 'display_pic' column in my database contained the full <img src='' /> tag for the display picture. when i took this out and changed it to just the string of the location of the image and surrounded the ". $s_dpic ." with the image tag, it worked perfectly, on countless tests.
  14. Problem solved, thanks everyone for all the help, and the debugging tips, they will come in very handy in the very near future more than likely
  15. After futtering around with the string value of $notification_nmessage i have found the actual error, by having . $s_dpic . in the query it is causing it to fail. So i'll try changing how that field works throughout the site and in the database and see if i can come up with a conclusion
  16. With help from what alan has posted i've concluded that it's to do with: $notifcation_nmessage = '<a href="#" onClick="showPMC('. $s_id .','. $other .')"><table class="notification"><tr><td>' . $s_dpic . '</td><td>' . $notification_message . '</td></tr></table></a>'; as when i try: $notifcation_nmessage = "hi there";   it works perfectly, so canyone see what the problem is with my variable? I've tried changing quotes but that hasn't worked, im think perhaps the parentheses could be the problem, but how do i have them ignored as part of a string?
  17. I've tried connecting to the database using the procedural style aka: $c = mysqli_connect(); and it still is not working, its like the line mysqli_query($c, $sql); / $db->query($sql); is being ignored completely
  18. Using dayo's sessionLog() function, i was able to view the sql query that is supposed to be inserted into the database. Now following sniko's advice i ran it in the database interface, it works. no problem at all. so i'm assuming the $db isnt working for some reason. because the query is correct and should be inserting the row. Hedge i've checked the indexes and there is only a primary index on notify_id.
  19. still no joy
  20. Although that too was a problem it still will not insert it, I'm calling the new_notification() function here: $pmessage = $db->real_escape_string($pmessage); $fr_id = $db->real_escape_string($fr_id); $c_id = $db->real_escape_string($c_id); if( $pmessage == " ") { } else { if ( $pmessage == "") { } else { $db->query("INSERT INTO p_messages(pmc_id, s_id, r_id, message, time) VALUES('$c_id', '$userid', '$fr_id', '$pmessage', NOW())"); new_notification($fr_id, $userid, 2, $c_id); } }
  21. I've created a couple of functions in php which are:   function new_notification($u_id, $sid, $t, $ot) { $uid = abs((int) $u_id); $s_id = abs((int) $sid); $type = abs((int) $t); $other = abs((int) $ot); switch ($type) { case 1: friend_request($uid, $s_id, $type, $other); break; case 2: new_pm($uid, $s_id, $type, $other); break; case 3: new_chat($uid, $s_id, $type, $other); break; } } function new_pm($u_id, $sid, $t, $ot) { include "mysqli.php"; global $db; $uid = $u_id; $s_id = $sid; $type = $t; $other = $ot; $s_details_sql = $db->query("SELECT * FROM users WHERE userid = '$s_id'"); $s_details = mysqli_fetch_array($s_details_sql); $s_dname = $s_details['display_name']; $s_username = $s_details['username']; $s_dpic = $s_details['display_pic']; $notification_message = "" . $s_dname . " (" . $s_username . ") has sent you a private message!"; $notifcation_nmessage = "<a href='#' onClick='showPMC(". $s_id .",". $other .")'><table class='notification'><tr><td><img src='" . $s_dpic . "' /></td><td>" . $notification_message . "</td></tr></table></a>"; $db->query("INSERT INTO notifications(userid, s_id, type, n_message, n_time) VALUES('$uid', '$s_id', '$type', '$notifcation_nmessage', NOW()"); }   as you can probably see once I call the function and and if $type is 2 then it'll cal the new_pm() function. The problem i am having is that $db->query("INSERT INTO notifications(userid, s_id, type, n_message, n_time) VALUES('$uid', '$s_id', '$type', '$notifcation_nmessage', NOW()"); does not insert a row into the database. Anyone have any ideas.
  22. Thanks HauntedDawg and rockwood for all the help, I appreciate it a lot.
  23. well then for now an interval seems like the most sensible solution, even though i think that if there were 1000 users talking to each other to have a part of a page reload every 5 seconds 1000 times would become a bit tedious on the server. And then that again leads me to my next question, is there a way for me to check that if a person presses the x button on their webbrowser, so that i can update a column in the database to 0 to show they are offline, i know that there is a way to timeout sessions, but i'll need to look at that.
  24. The update_imessages is simply setting some columns in the database to 1. however i do see how the $.post might slow this down. Ok i've changed it now, and used simply the .keypress() and it works so much faster now! i've rearranged some code, deleted some and what not and now it is far faster no matter how much is written, so that's definitely helpful. i also have it so that it will scroll to the bottom of the div when it loads and when a new message is sent. One question i do have now though is, if i have two users talking to each other, and one presses enter and it sends the message, how do i update the other user's div after the message has been sent? therefore i will avoid having to let the div reload every couple of seconds?
  25. yeah i noticed that myself, so i put into the php script a few if statements to avoid inserting it into the databae, but if it is double/triple posting, then it will still take a long time to finally load the messages. Is there an alternative to the "bind" function that i should look at?
×
×
  • Create New...