Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Total villages
#1
[Image: screenshot2on.png]
For versions with bonus:
PHP Code:
<table class="vis" width="40%">
                           <
tr>
                <
th colspan="2">Statistics on a barbarian villages</th>        
                </
tr>
                <
tr>
            <
th>Total villages:</th><td>{php}$a mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM `villages` WHERE `continent` > '0'"));
                echo 
$a[0];0{/php}</td>
                </
tr>
           <
th>Total abandoned villages:</th><td>{php}$a mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM `villages` WHERE `userid` = '-1'"));
                echo 
$a[0];0{/php}</td>
                <
tr>
            <
th>Total abandoned bonus villages:</th><td>{php}$a mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM `villages` WHERE `bonus` > '0'"));
                echo 
$a[0];0{/php}</td>
                </
tr>
                <
tr>
            <
th>Villages of players:</th><td>{php}$a mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM `villages` WHERE `userid` > '-1'"));
                echo 
$a[0];0{/php}</td>
                </
tr>
                <
tr>
                <
th>Your villages:</th><td>{php$this->_tpl_vars['vills'] = mysql_num_rows(mysql_query("SELECT * FROM `villages` WHERE `userid` = '".$this->_tpl_vars['user']['id']."'"));{/php}
            {
$vills}</td>
            </
tr>
                
            
                <
tr>    
</
tr>    </table

For versions without bonus:
PHP Code:
<table class="vis" width="40%">
                           <
tr>
                <
th colspan="2">Statistics on a barbarian villages</th>        
                </
tr>
                <
tr>
            <
th>Total villages:</th><td>{php}$a mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM `villages` WHERE `continent` > '0'"));
                echo 
$a[0];0{/php}</td>
                </
tr>
           <
th>Total abandoned villages:</th><td>{php}$a mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM `villages` WHERE `userid` = '-1'"));
                echo 
$a[0];0{/php}</td>
                <
tr>
            <
th>Villages of players:</th><td>{php}$a mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM `villages` WHERE `userid` > '-1'"));
                echo 
$a[0];0{/php}</td>
                </
tr>
                <
tr>
                <
th>Your villages:</th><td>{php$this->_tpl_vars['vills'] = mysql_num_rows(mysql_query("SELECT * FROM `villages` WHERE `userid` = '".$this->_tpl_vars['user']['id']."'"));{/php}
            {
$vills}</td>
            </
tr>
                
            
                <
tr>    
</
tr>     </table
Reply




Users browsing this thread: 2 Guest(s)