- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
$query = mysql_query("SELECT w_id,title FROM bhost_weblogs
WHERE owner='".$user_info['username']."'");
while($blog = mysql_fetch_assoc($query))
{
$stat = mysql_query("SELECT * FROM stat WHERE blog='".$blog['w_id']."' AND user!='' AND
datestamp>='$d2' ORDER BY datestamp DESC");
$all_users = mysql_result(mysql_query("SELECT Count(blog) FROM stat
WHERE blog='".$blog['w_id']."' AND datestamp>='$d2'"),0);
$reg_users = mysql_result(mysql_query("SELECT Count(blog) FROM stat
WHERE blog='".$blog['w_id']."' AND user!='' AND datestamp>='$d2'"),0);
$unreg_users = mysql_result(mysql_query("SELECT Count(blog) FROM stat
WHERE blog='".$blog['w_id']."' AND user='' AND datestamp>='$d2'"),0);
echo "<center>Всего: $all_users<br />
Зарегистрированных пользователей: $reg_users<br />
Незарегистрированных пользователей: $unreg_users</center>";
echo "<table cellpadding='0' cellspacing='0' align='center' class='form'>";
while($statd = mysql_fetch_assoc($stat))
{
echo ...;
}
echo "</table><br /><br />";
}
Очень правильная работа с базой, подумаешь пара лишних запросов.
guest 06.09.2009 19:02 # +1
Смесь разметки, кода, констант, и SQL - однозначно зачет!
guest 07.09.2009 05:55 # +1
paranoid 08.09.2009 12:52 # 0
guest 15.09.2009 10:49 # 0
bdevnameless 25.08.2021 19:25 # 0