1st step, make a count.php and put the following simple code:
PHP Code:
<?php
// Count script by LG-2. Gets the rows in MySQL and outputs them.
mysql_select_db($db);
$result = mysql_query( "SELECT * FROM users" )
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
$result2 = mysql_query( "SELECT link_id FROM links" )
or die("SELECT Error: ".mysql_error());
$num_links = mysql_num_rows($result2);
?> PHP Code:
include('count.php');
Now 3rd step I feel bad about but I havent messed with smarty much so I haven't been able to add it to smarty.
Open index.php and look where you want to put the code to output the number. I know this is going to be a little complicated but here's an example of how I did it:
PHP Code:
echo '<center><table width="90%" height="20" border="0" cellspacing="0" cellpadding="0" bgcolor="#f1f1f1">
<tr>
<td width="2%" valign="top"><img src="/images/newscorner3.gif" width="20" height="20" /></td>
<td width="96%"><div align="center"><font class="h5red"><a href=shakeit.php>Buscar Otras Noticias</a> / <a href=submit.php>Zumba una Noticia!</a> / </font></right><font class="thiscat"><strong><a href="topusers.php">Usuarios registrados:</a> </strong></font>';
echo "<font class=h5red>$num_rows / </font> ";
echo '<font class="thiscat"><strong><a href="topstories.php">Historias Publicadas:</a> </strong></font>';
echo "<font class=h5red>$num_links</font>";
echo '</td><td width="2%" valign="top"><img src="/images/newscorner4.gif" width="20" height="20" /></td>
</tr>
</table></center><p><font class="thiscat">* Estas noticias son publicadas por los usuarios.<br>
* Cualquier pregunta o para reportar un error (bug), por favor enviale un email a LG-2 <a href="mailto:lg2@zumbalo.com">(lg2@zumbalo.com)</a>.</font><br>
<font class="h5red"><a href="tuts.php">Aprende a usar esta pagina!</a></font><p>';
$num_links is the variable for the stories count.
Now the stories might display a bigger number than the stories that actually appear and that is because it also count the discarted stories. Is also good to run the meneame.net script.




Linear Mode

