(This post was last modified: 03.12.2012, 05:02 by Kevin Silva.)
03.12.2012, 05:01
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>