Регистрирани и последен регистриран?

kenwood10

Registered
Здравейте... Някои сеща ли се за урок които мога да изведа колко регистрирани потребители и кои е последният регистриран от базата ми данни ?
 
PHP:
<?php
$obshto = mysql_num_rows(mysql_query("SELECT * FROM `users`;");
echo "Регистрирани: {$obshto}";
$last = mysql_fetch_object(mysql_query("SELECT `username` FROM `users` ORDER BY `id` DESC;"));
echo "Последен:  {$last->username}";
?>
 
Супер перфектноо.... Ще е хубаво да се добави един такъв урок мисля , че ще бъде полезен на много хора.. сега имам един друг проблем как да го съчетая с това..

PHP:
<td align="center"><span style="color:#ffffff;"><b><font size="3"><? $timeonline = time()-600; $sqlonline = mysql_num_rows(mysql_query("SELECT * FROM users WHERE timeonline > $timeonline")); if($sqlonline>0) { echo $sqlonline; } else { echo '0'; } ?></b></font><br/>онлайн</td>

Когато интегрирам кодът които ми даде и ми изкарва грешка.. Ако можеш да ми помогнеш ще си златен :)
 
Ще е хубаво и да давате подредени кодове както и грешките, които излизат.

LAST EDIT:
PHP:
<td align="center">
<span style="color:#ffffff;">
<?php
$timeonline = time()-600;
$query = mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `timeonline` > '{$timeonline}'")) ;
if($query > 0) {
	echo "<b><font size=\"3\">{$query}</b></font><br />онлайн";
} else {
	echo "<b><font size=\"3\">Няма онлайн потребители</b></font>";
}
$obshto = mysql_num_rows(mysql_query("SELECT * FROM `users`;"));
echo "Регистрирани: {$obshto}";
$last = mysql_fetch_object(mysql_query("SELECT `username` FROM `users` ORDER BY `id` DESC;"));
echo "Последен:  {$last->username}";
?>
</td>
 
PHP:
Parse error: syntax error, unexpected ';' in C:\Program Files\xampp\htdocs\header.php on line 107

Ето го и целият код:

PHP:
<?

ob_start();

session_start();

include("includes/functions.php");

include("includes/settings.php");

makeraces();

vipexpires();

vipmoney();

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="bg">

<head>

	<meta http-equiv="content-type" content="text/html; charset=windows-1251" />

	<title><? echo $title; ?></title>

	<link rel="stylesheet" href="style.css" type="text/css">

	<LINK REL="SHORTCUT ICON" HREF="favicon.ico">

<script language="javascript" type="text/javascript">

function clearText(theField)

{

if (theField.defaultValue == theField.value)

theField.value = '';

}



function addText(theField)

{

if (theField.value == '')

theField.value = theField .defaultValue;

}

</script>

<body>



<table border="0" cellspacing="0" align="center" cellpadding="0" width="820px">

 <tr>

  <td width="820px" align="right">



<table border="0" cellspacing="0" cellpadding="0" style="margin-right: 25px;">

<tr>

<td><table border="0" cellspacing="0" cellpadding="0"><tr><td class="ml" width="10px"></td><td class="mbg" align="center"><a href="./index.php"><span style="color:#ffffff;">Начало</span></a></td><td class="mr" width="8px"></td><td>  </td></tr></table></td>

<td><table border="0" cellspacing="0" cellpadding="0"><tr><td class="ml" width="10px"></td><td class="mbg" align="center"><a href="./top_racers.php"><span style="color:#ffffff;">Класация</span></a></td><td class="mr" width="8px"></td><td>  </td></tr></table></td>

<td><table border="0" cellspacing="0" cellpadding="0"><tr><td class="ml" width="10px"></td><td class="mbg" align="center"><a href="./last_races.php"><span style="color:#ffffff;">Последни състезания</span></a></td><td class="mr" width="8px"></td><td>  </td></tr></table></td>

<td><table border="0" cellspacing="0" cellpadding="0"><tr><td class="ml" width="10px"></td><td class="mbg" align="center"><a href="./online_racers.php"><span style="color:#ffffff;">Онлайн потребители</span></a></td><td class="mr" width="8px"></td><td>  </td></tr></table></td>
<td><table border="0" cellspacing="0" cellpadding="0"><tr><td class="ml" width="10px"></td><td class="mbg" align="center"><a href="./contact.php"><span style="color:#ffffff;">Контакти</span></a></td><td class="mr" width="8px"></td><td>  </td></tr></table></td>
<td><table border="0" cellspacing="0" cellpadding="0"><tr><td class="ml" width="10px"></td><td class="mbg" align="center"><a href="./rules.php"><span style="color:#ffffff;">Правила</span></a></td><td class="mr" width="8px"></td><td>  </td></tr></table></td>
<td><table border="0" cellspacing="0" cellpadding="0"><tr><td class="ml" width="10px"></td><td class="mbg" align="center"><a href="./horizontalad.php"><span style="color:#ffffff;">Реклама</span></a></td><td class="mr" width="8px"></td><td>  </td></tr></table></td>
<td><table border="0" cellspacing="0" cellpadding="0"><tr><td class="ml" width="10px"></td><td class="mbg" align="center"><a href="./logout.php"><span style="color:#ffffff;">Изход</span></a></td><td class="mr" width="8px"></td><td>  </td></tr></table></td>

 </tr>

</table>



  </td>

 </tr>

 <tr>

  <td width="820px" height="116px" class="header">

	<table border="0" align="right" class="online" style="margin-right: 50px;">

	 <tr>

<td align="center">
<span style="color:#ffffff;">
<?php
$timeonline = time()-600;
$query = mysql_query("SELECT * FROM `users` WHERE `timeonline` > '{$timeonline}'")or die(mysql_error());
if(mysql_num_rows($query) > 0) {
        echo "<b><font size=\"3\">{$sqlonline}</b></font><br />онлайн";
} else {
        echo "<b><font size=\"3\">0</b></font><br />онлайн";
}
$obshto = mysql_num_rows(mysql_query("SELECT * FROM `users`;");
echo "Регистрирани: {$obshto}";
$last = mysql_fetch_object(mysql_query("SELECT `username` FROM `users` ORDER BY `id` DESC;"));
echo "Последен:  {$last->username}";
?>
</td>

	 </tr>

	</table>
  </td>

 </tr>

 <tr>

  <td width="820px" class="bg">

   <table border="0" width="98%" align="center" cellspacing="2" cellpadding="2">

	<tr>

	 <td>

Благодаря предварително и съжалявам за малко дадената информация!
 

Горе