Airborne328 Posted October 5, 2008 Share Posted October 5, 2008 First, I have read the guidelines, and I certainly hope I am going to post/follow them correctly. Summary: I am online gamer that runs a site where players and clans can download a "combined" AC "ac=anticheat org", banlist that will exclude all duplicates. The script works fine and returns them with a .dat file containing this merged list of players unique guids. Their are 5 AC's, AASA, ACI, AoN, PsB and PBBans. Combined_banlist.php <?php error_reporting(0); set_time_limit(0); $link = mysql_connect('************', '********', '********'); if (!$link) die('Could not connect: ' . mysql_error()); $db_selected = mysql_select_db('Airborn_repo_site', $link); if (!$db_selected) die ('Unable to select database: ' . mysql_error()); //$Query = "SELECT CONCAT('[', LPAD(year, 4, '0') , '.', LPAD(month, 2, '0'), '.', LPAD(day, 2, '0'), ' ', LPAD(hour, 2, '0'), ':', LPAD(min, 2, '0'), ':', LPAD(sec, 2, '0'), '] ', guid) AS banline FROM `bans` WHERE 1 GROUP BY guid"; $Query = "SELECT CONCAT('[aaorepodepot.us] ', guid) AS banline FROM `bans` WHERE 1 GROUP BY guid"; $result = mysql_query($Query); if (!$result) die("Inable to execute query: " . mysql_error()); Header("Content-Type: application/x-download"); Header("Content-Disposition: attachment; filename=\"combinedACmbl.dat\""); while ($row = mysql_fetch_assoc($result)) echo $row['banline'] . "\r\n"; mysql_free_result($result); mysql_close($link); ?> I have had several requests, to have a separate link/download that would exclude a specific AC. I have read and read and can't figure out the proper exclude command. __________ MySQL info: MySQL client version: 4.1.20 Table structure for table bans: CREATE TABLE IF NOT EXISTS `bans` ( `year` int(11) NOT NULL default '0', `month` int(11) NOT NULL default '0', `day` int(11) NOT NULL default '0', `hour` int(11) NOT NULL default '0', `min` int(11) NOT NULL default '0', `sec` int(11) NOT NULL default '0', `guid` varchar(32) NOT NULL default '', `name` varchar(255) NOT NULL default '', `ip` varchar(255) NOT NULL default '', `reason` varchar(255) NOT NULL default '', `ac` varchar(255) NOT NULL default '', PRIMARY KEY (`guid`,`ac`(3)), KEY `ac` (`ac`), KEY `ip` (`ip`), KEY `name` (`name`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; _______________ ac field information: SELECT COUNT( * ) AS `Rows` , `ac` FROM `bans` GROUP BY `ac` ORDER BY `ac` LIMIT 0 , 30 Rows ac 41225 AASA 37726 ACI 33523 AON 2357 PBBans 8388 PSB ___________________ To close, I have read manual after manual and searched this site for possible answers. All tries have failed when I try to edit existing php to exclude an ac field. What am I doing wrong/missing, or what can I do to make it right.? ??? Thank you in advance for any assistance, and I certainly hope I followed the guidelines in posting here. Airborne Quote Link to comment https://forums.phpfreaks.com/topic/127141-solved-excluding-a-certain-field-within-a-php-script/ Share on other sites More sharing options...
Barand Posted October 5, 2008 Share Posted October 5, 2008 SELECT COUNT( * ) AS `Rows` , `ac` FROM `bans` WHERE ac <> 'AASA' GROUP BY `ac` LIMIT 0 , 30 the above excludes 'AASA'. To exclude multiple values you can SELECT COUNT( * ) AS `Rows` , `ac` FROM `bans` WHERE ac NOT IN ('AASA', 'ACI') GROUP BY `ac` LIMIT 0 , 30 Note: GROUP BY will also ORDER BY the same column by default. Quote Link to comment https://forums.phpfreaks.com/topic/127141-solved-excluding-a-certain-field-within-a-php-script/#findComment-657714 Share on other sites More sharing options...
Airborne328 Posted October 5, 2008 Author Share Posted October 5, 2008 Okay so, Should the combined_banlist.php query above be edited From $Query = "SELECT CONCAT('[aaorepodepot.us] ', guid) AS banline FROM `bans` WHERE 1 GROUP BY guid"; To $Query = "SELECT CONCAT('[aaorepodepot.us] ', guid) AS banline FROM `bans` WHERE ac <> 'AASA' GROUP BY guid"; I hope I am understanding, cause my brain is hurting right about now.... TY Quote Link to comment https://forums.phpfreaks.com/topic/127141-solved-excluding-a-certain-field-within-a-php-script/#findComment-657736 Share on other sites More sharing options...
Airborne328 Posted October 5, 2008 Author Share Posted October 5, 2008 No need to answer, after testing this it worked like a charm. I sincerely appreciate the prompt and knowledgable reply. Quote Link to comment https://forums.phpfreaks.com/topic/127141-solved-excluding-a-certain-field-within-a-php-script/#findComment-657745 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.