mysql> desc counter;
+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| num | varchar(11) | YES | | NULL | |
| num1 | varchar(11) | YES | | NULL | |
| daytime | varchar(12) | YES | | NULL | |
+---------+-------------+------+-----+---------+-------+
3 rows in set (0.01 sec)
<?
include "condb.inc";
$A=date("Y");
$B=date("m");
$C=date("d");
$D=$A.$B.$C;
$query = "select num,num1,daytime from counter" ;
$result = mysql_query($query,$connect);
$row=mysql_fetch_array($result);
if($D != $row[daytime]) {
$query="update counter set num=1,num1=num1+1,daytime='$D'";
$result = mysql_query($query,$connect);
$query = "select num,num1,daytime from counter" ;
$result = mysql_query($query,$connect);
$row=mysql_fetch_array($result);
}
else
{
$query="update counter set num=num+1,num1=num1+1,daytime='$D'";
$result = mysql_query($query,$connect);
$query = "select num,num1,daytime from counter" ;
$result = mysql_query($query,$connect);
$row=mysql_fetch_array($result);
}
echo "
<table border='0' cellpadding='0' width='120'>
<tr>
<td width='35'><p><font size='2' color='navy'><b>Àüü</b></font></td>
<td width='74'><p><font size='2'><b>$row[num1]</b></font></td>
</tr>
<tr>
</table>
";
?>
|