TWLan Forum
Total villages - Printable Version

+- TWLan Forum (https://twlan.org)
+-- Forum: Legacy (https://twlan.org/forumdisplay.php?fid=61)
+--- Forum: TWLan 1.x (DSLan) (https://twlan.org/forumdisplay.php?fid=62)
+---- Forum: Deutsche Community (https://twlan.org/forumdisplay.php?fid=65)
+----- Forum: Spielerprojekte (https://twlan.org/forumdisplay.php?fid=9)
+------ Forum: Tools und Spielerprojekte (https://twlan.org/forumdisplay.php?fid=10)
+------ Thread: Total villages (/showthread.php?tid=5541)



Total villages - Kevin Silva - 03.12.2012

[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