40 行
		
	
	
		
			无行尾
		
	
	
		
			669 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			40 行
		
	
	
		
			无行尾
		
	
	
		
			669 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| class DXCC extends CI_Model {
 | |
| 
 | |
| 	function __construct()
 | |
| 	{
 | |
| 		// Call the Model constructor
 | |
| 		parent::__construct();
 | |
| 	}
 | |
| 	/**
 | |
| 	*	Function: mostactive
 | |
| 	*	Information: Returns the most active band
 | |
| 	**/
 | |
| 	function info($callsign)
 | |
| 	{
 | |
| 		$exceptions = $this->db->query('
 | |
| 				SELECT *
 | |
| 				FROM `dxccexceptions`
 | |
| 				WHERE `prefix` = \''.$callsign.'\'
 | |
| 				LIMIT 1 
 | |
| 			');
 | |
| 		
 | |
| 		if ($exceptions->num_rows() > 0)
 | |
| 		{
 | |
| 			return $exceptions;
 | |
| 		} else {
 | |
| 			
 | |
| 			$query = $this->db->query('
 | |
| 					SELECT *
 | |
| 					FROM dxcc
 | |
| 					WHERE prefix = SUBSTRING( \''.$callsign.'\', 1, LENGTH( prefix ) )
 | |
| 					ORDER BY LENGTH( prefix ) DESC
 | |
| 					LIMIT 1 
 | |
| 				');
 | |
| 			
 | |
| 			return $query;
 | |
| 		}
 | |
| 	}
 | |
| }
 | |
| ?>
 |