Jump to content

Kryptix

Members
  • Posts

    283
  • Joined

  • Last visited

    Never

Everything posted by Kryptix

  1. Could you show me where please? This seems to work OK but I need to set the var within the same query and I'm struggling with that: SELECT a.username, a.user, a.Rank FROM ( SELECT b.username, a.user, SUM(a.exp_attack) AS Attack, @num := @num +1 AS Rank FROM `rscd_experience` a JOIN `rscd_players` b ON `b`.`user` = a.`user` GROUP BY a.user ORDER BY Attack DESC ) AS a WHERE a.username = 'Kryptix' The above query returns: username | user | Rank Kryptix | 29518873935 | NULL
  2. Ugh. Never mind. I had another query at the bottom of the page updating it back to normal... Blah! I originally put it there as a debug and forgot to remove it. Cheers anyway.
  3. Someone tried telling me the other day that using ' was faster than ". Is there any truth in that what-so-ever?
  4. <?php $data = array("cat", "bat", "rat", "net"); foreach($data as $value) { echo $value; } ?> Output: catbatratnet
  5. I showed in my first post that I echo()'d out the query and I copied and pasted it too. It isn't just that which isn't setting, `clan_confirmed` isn't being set to 1 either. I've used $db->insert_id() in another page and it works fine.
  6. It's a clan system for this game I run. First of all I insert a new record into `clans` and then grab the mysql_insert_id() so I can update their user record with what clan they're in. The first query works fine, but the only bit that works on the second query is setting `clan_since` to UNIX_TIMESTAMP(). Setting `clan` to mysql_insert_id() doesn't work and neither does setting `clan_confirmed` to '1'. I echo()'d out the exact query too and it looks fine: UPDATE `users` SET `clan` = '15', `clan_confirmed` = '1', `clan_since` = UNIX_TIMESTAMP() WHERE `id` = '101' When I copy and paste that into phpMyAdmin it works absolutely fine... So seriously, what's wrong? It's probably going to be something simple but I've been trying to fix this for 3 hours now and my mind feels like it's gunna explode. $db->query("INSERT INTO `clans` (`owner`, `tag`, `name`, `created_time`, `created_ip`, `created_user`) VALUES ('" . $db->escape($pun_user['id']) . "', '" . $db->escape($_POST['tag']) . "', '" . $db->escape($_POST['clan']) . "', UNIX_TIMESTAMP(), '" . $db->escape($_SERVER['REMOTE_ADDR']) . "', '" . $db->escape($pun_user['id']) . "')"); $id = $db->insert_id(); $db->query("UPDATE `users` SET `clan` = '" . $db->escape($id) . "', `clan_confirmed` = '1', `clan_since` = UNIX_TIMESTAMP() WHERE `id` = '" . $db->escape($pun_user['id']) . "'"); echo "UPDATE `users` SET `clan` = '" . $db->escape($id) . "', `clan_confirmed` = '1', `clan_since` = UNIX_TIMESTAMP() WHERE `id` = '" . $db->escape($pun_user['id']) . "'";
  7. RSCEmulation is what gets attacked. If we're down players are looking for other servers to play which is why they do it. Sad really, but whatever... It costs a fortune to protect about large attacks too.
  8. The 4 sites that are on the dedicated server belong to me. They're all mine and it's my dedicated server. I have 4gB/s DDoS protection with Staminus Communications. Our largest attack to date was 3.8gB/s but we regularly see 2gB/s+ attacks.
  9. I DO have DDoS issues hence paying a lot every month to protect against it. Why would I turn something off that I pay for?
  10. That's correct... What's your point?
  11. Where did I say I'm not having issues with DDoS attacks? Why would I pay for DDoS protection if I wasn't? That's for your design comment but in all due respect, have you seen your own site? You too have slow loading thingy (I have no-idea what to call it) on the left and I really wouldn't describe your site as modern... Also, clicking a picture on your site took literally 10 seconds to load, and a further 10 seconds when skipping to the next one. It's like me saying "I hate black and grey designs!" when I have one myself. :-\ Anyway, cheers for your comment.
  12. That's not the point, I'm using it as an example...
  13. So, I love the idea of Ajax and I really want to get into it. But I have a few issues. Say for example if I have a users table with 30,000 users registered, and a column `online` which dictates whether they're online or not... I then have a Ajax script saying something like, "There's currently 38 users online!" updating every second or so on a timer. This worked fine when I tested myself but as soon as you have 38 people on the site, that then turns into 38 queries a second... Which sent the CPU to 100%. So the only way I can think of doing it, is by having a table dedicated to Ajax with stats like that updating every second, and then have the users simply query one entry rather than 30,000. It makes sense, but is there an easier way? If that's correct, how do you go about running the query every second? Is that even the right way to do this? Maybe you have a table with columns `online_count` and `time`, each time Ajax queries for the count it checks to see if it's more than a second old and if so, run the script to update it? Am I thinking straight or am I way off?
  14. It loads instantly for me although we are on a DDoS protection package which basically validates every incoming connection, if you're opening a new connecting sometimes it can take 1-5 seconds but after it's open it will load as quick as any other site. Regarding the design comment, I guess that's just down to opinion as everyone I've shown loved it. But meh, thanks for your comment.
  15. I meant it gave the exact same result.
  16. It's difficult to say without seeing what data is in the tables to be honest.
  17. No offence but that's one of the worst sites I've ever seen.
  18. RSCEmulation is a RuneScape Classic private server. http://www.RSCEmulation.net New website I've been working on. Any comments or suggestions welcomed.
  19. Wow... Why are people making huge classes if that works? Is that new? Thanks man.
  20. I need to use PHP to check a files MD5 checksum. I've Google'd and found a few classes but was unable to get any of them working. I need it to be as simple and small as possible, ideally just one file without using external classes. Has anyone got any idea how I could do this?
  21. LAST_INSERT_ID(`id`) is the same as MAX(`id`).
  22. I found this post but it returns an array which I don't know how I can use in the middle of a SQL query.
  23. Use this: $sql = "INSERT INTO `joke` SET `joketext` = '" . $joketext . "', `jokedate` = 'today\'s date';";
  24. I'm trying to automatically insert a new topic on a FluxBB forum but I'm running into problems. INSERT INTO `posts` (`poster`, `poster_id`, `message`, `posted`, `topic_id`) VALUES ('RSCEmulation', 19821, 'Here's my post', UNIX_TIMESTAMP(), (SELECT MAX(`id`) + 1 FROM `topics`)); INSERT INTO `topics` (`poster`, `subject`, `posted`, `last_post`, `last_post_id`, `last_poster`, `forum_id`) VALUES ('RSCEmulation', 'Here's my topic', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), (SELECT MAX(`id`) FROM `posts`), 'RSCEmulation', 37); Both `posts` and `topics` use each others ID (which is a primary key and automatically incremented) to link together. When inserting the entry I need to get the corresponding ID. Someone in IRC said to use the above but it's not working, it works OK but if I delete a record the expected ID is 2 but the above returns 0 (and continues increasing the more rows that have been deleted). I'm also writing this in Java so it would help if I don't use any PHP functions. Cheers guys.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.