-
Posts
93 -
Joined
-
Last visited
Never
Everything posted by Fog Juice
-
*update* basically I'm trying to do something like count all nicknames with a distinct ip address per nickname. So if a nickname has duplicate ip addresses, only the 1 ip address is counted.
-
Thanks, however, I don't want it to show the total count, just the count of nickname per ip address. For example, the print out in my original post shows fogjuice three times, using group by will obviously group them all together and print a count of 3 but that is incorrect for what i'm trying to do. It should only count two because there are only two unique ip addresses, so the third entry shouldn't be counted because it is a duplicate nickname/ip. I don't think what i'm trying to do is as simple as a group by, I'm hoping it isn't too hard, I just dont know where to begin.
-
thanks for trying, but nickname is already in the group by. I'm trying to get it so it excludes all duplicate ip/nickname's in the count(nickname). So basically, if there are two or more rows with the same nickname and ip address, only one is counted.
-
What I'm trying to do is create a top list which will display the top 10 usernames by unique ip address. So basically, if an ip address is showing multiple times with the same nick name, then only one entry should be counted. This sql I'm using is below, but I'm unsure of how to filter it so it isn't showing every single time a nickname is entered by the same ip in the count. Only one nickname per IP should be counted in the sql statement below. SELECT nickname, count(nickname) nbr FROM `log` group by ip_addr, nickname order by nbr desc limit 10; id, nickname, ip_addr 1 fogjuice 2.2.2.210 2 fogjuice 2.2.2.210 3 fogjuice 21.6.3.210 4 bull 2.2.2.210 5 bull 29.20.13.2 6 bull 2.2.2.210 7 harvey 2.2.2.210 8 harvey 2.2.2.210 9 harvey 2.2.2.210 10 jane 2.2.2.210 11 tom 2.2.2.210
-
Hmm it seems that either one doesn't work when trying to go directly to the url, it results in http://yourdomain.com/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php Basically, there won't by any directories. All I need is a .htaccess that changes any http://yourdomain.com/nameofwhatever to http://yourdomain.com/index.php/nameofwhatever.
-
Hello, I have the following htaccess RedirectMatch 301 ^/.*$ http://mydomain.com/index.php What I would like to do is add it so the requested director would be added onto the http://mydomain.com/index.php. So for example, if someone were trying to access http://mydomain.com/folder then the .htaccess would redirect to http://mydomain.com/index.php/folder. I've been searching for hours on google but can't figure it out, does anyone have any tips? The .htaccess syntax is what confuses me. Thanks. *edit* I think I got it: RedirectMatch 301 (.*) http://mydomain.com/index.php$1
-
regex strangely not allowing users to paste in textbox?
Fog Juice replied to Fog Juice's topic in Javascript Help
What I don't understand though is why does pasting work in the first textbox, but not the second? They are both using the same functions, same key codes. -
I have the following code below which allows only alphanumeric characters for one text box, and then only numeric characters in the second. My problem is that in the first box, users can paste, which is perfectly fine, but in the second text box, they can't paste. I'd like it so that users could paste in each text box. Does anyone know why the second text box doesn't allow users to paste? It is quite odd to me and I'm not sure why. One other thing is that the first textbox allows the % sign, but as far as I can see, the regex I have is only for alphanumeric characters. <script> function alphanumericscan(e, call){ var code; if (!e) var e = window.event; if (e.keyCode) code = e.keyCode; else if (e.which) code = e.which; var character = String.fromCharCode(code); //alert(\'Character was \' + character); //alert(code); if (code == 8 || code == 9 || code == 37 || code == 39 ) return true; if(call == "alpha") var AllowRegex = /^[a-zA-Z0-9]+$/; else var AllowRegex = /^[0-9]+$/; if (AllowRegex.test(character)) return true; return false; } </script> Letters and numbers only: <input onkeypress="return alphanumericscan(event, 'alpha');" /><br /> Numbers only: <input onkeypress="return alphanumericscan(event, 'numonly');" />
-
activating script five times a day (time math help request)
Fog Juice replied to Fog Juice's topic in PHP Coding Help
Perfect, thank you! I'm horrible at time math. -
activating script five times a day (time math help request)
Fog Juice replied to Fog Juice's topic in PHP Coding Help
Thank you, and I apologize for not being more clear in my question. I've attached an image to make it easier to understand what I'm trying to do. It is easier to show you a diagram rather than give you a word problem. In the image you will see sets of blocks. So for example, there is 86400 seconds in a day and 5 blocks per day. That means each block is 17280 seconds. How can I determine how many seconds are left in each block before the next one is reached? 5 is just an arbitrary number, it could be 10, 50, 1023, or any number the user sets. There could be 1440 blocks a day (each block is 60 seconds), there could be 2000 (each block is 43.2 seconds). [attachment deleted by admin] -
Hello, what I'm trying to do is figure out a formula or equation that will help me to activate a script X amount of times a day where X is set by the user. My problem is discovering how many times left to activate the script it on the day they set X. For example, the user sets the script to activate 5 times day, or in other words, every 17280 seconds (since there are 86400 seconds in a day). Now, when activating it each day it is easy to keep track of because you can just calculate each block by 17280 seconds. My problem is how do I figure out how many times are left on the day the user sets the script. For example, if the user sets the script to activate 5 times a day and there is only half a day left, the script should only activate a few more times that day. Thanks!
-
Hello, I want to make one mysql query but it will be connecting to two different databases on two different servers. Is this possible? Here is the query I have written, I'm just not sure how to get it to work with two db's. $sql = "SELECT cdb.ca.achievement, cdb.c.name, cdb.c.race, cdb.c.class, cdb.c.gender, cdb.c.level, vb.a.name FROM cdb.characters c, cdb.character_achievement ca, vb.achievements a WHERE cdb.c.guid = cdb.ca.guid AND cdb.ca.achievement = vb.a.id ORDER BY cdb.ca.date DESC LIMIT 100 ;"; Any help would be very much appreciated.
-
Does anyone have an example of this? I'm quite lost tbh, I've searched all over the internet and feel like I understand the concept but just getting it into code is what I'm having trouble with.
-
Does anyone know if it is possible for a minimax algorithm to be created in php? If you don't know what I'm talking about, please have a quick look here -> http://ai-depot.com/articles/minimax-explained/ . It is used to create a sort of search tree to determine the best course to win logic games. I'm trying to create tic tac toe and I have everything working other than a good AI, hoping I can use minimax with PHP. Right now my tic tac toe CPU moves are calculated randomly, as a consequence unfortunately it is easy beat the computer. Any suggestions would be helpful, if anyone has ever used something like this before in PHP I would appreciate it if you could share an example. Thanks.
-
Hello, I keep getting the following error from this code but I can't figure out waht the problem is. Any suggestions? Error: [Err] 1005 - Can't create table 'dsds.mana_char_status_effects' (errno: 150) Code: -- -- table: `mana_char_status_effects` -- CREATE TABLE IF NOT EXISTS `mana_char_status_effects` ( `char_id` int(10) unsigned NOT NULL, `status_id` smallint(5) unsigned NOT NULL, `status_time` int(10) signed NOT NULL, -- PRIMARY KEY (`char_id`, `status_id`), FOREIGN KEY (`char_id`) REFERENCES `mana_characters` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
Anyone.. please? I'm trying to learn this join/left join business but I just can't grasp it with online tutorials which all seem to be shit for what I'm trying to do. I'd really appreciate it if someone could give me a little help.
-
Hello, I seem to be stuck with a mysql query that runs very long because of a subquery (I know why, just not sure of how to work around the problem). I was hoping someone could help me fix this by making a suggestion on how to use a join. I've never used JOIN, LEFT JOIN, etc so I'd appreciate if someone could give me a little guidance. The query I'm stuck with is this: SELECT ga.name, g.uuid, g.id, g.game_id, g.uuid, g.date, ml.x, ml.y, ml.z, r.region_name, g.name as game_name, gt.id as game_type, gt.name as game_type_name, ga.icon FROM games_owned g, games ga, reg r, locations ml, game_types gt $pfrom WHERE g.owner_id = '".cleanup('', $_SESSION['user_id'])."' AND ga.id = g.game_id AND ml.game_id = g.id AND gt.id = ga.game_type_id AND ml.date = (SELECT MAX(date) FROM locations WHERE game_id = g.id) AND ml.region_id = r.id $filter GROUP BY g.id ORDER BY g.date DESC; Any suggestions on how to improve this query would be greatly appreciated, the database has tens of thousands of records so sql efficiency is needed. There is a little bit of PHP code in this example but if you can please help me without using PHP, that would be great. Thanks.
-
Is there another server side language that I can mash up with PHP to do the sorting and searching, something that might be faster? I'm just looking for suggestions really, from anyone that might have had to do this in the past.
-
I've been comparing execution time between using in_array($needle, $haystack) and then just using a for loop until I find the correct value. Although in_array is slightly faster, there is no significant performance increase. Does someone know of a more efficient way for finding a needle in a haystack with PHP?
-
Hello, I'm using array_unique() to clear out duplicate values in an array that contains about 1125 items. All items in the array are string value but for some reason, array_unique() will clear out duplicates and in some instances leave an empty value in the array. Does anyone know what might cause this? *update* I tried array_keys(array_flip()) and that seems to work better. Any idea what the problem is with array_unique()?
-
sixteen numbers and finding the right combination
Fog Juice replied to Fog Juice's topic in PHP Coding Help
I'd be willing to pay someone $10-20 to write this function, if someone could help. lol. -
[SOLVED] Not display records that are blank?
Fog Juice replied to twilitegxa's topic in PHP Coding Help
So it is not null, it's just an empty field? Couldn't you just do != ''? Or is the potential of being a few blank spaces? If that is the case maybe $get_sub_notes = "select notes from scout_sub_attributes where identity = '$identity' AND TRIM(notes) != '' "; -
[SOLVED] Not display records that are blank?
Fog Juice replied to twilitegxa's topic in PHP Coding Help
Could you add something like "select notes from scout_sub_attributes where identity = '$identity' and notes IS NOT NULL"? -
What else do you want? Your question isn't very clear if you want more than what I've given you.
-
In your example you set the result page on your form to search.php, so place that code I gave you in search.php.