Copy CodeThe code is as follows:
$link =mysql_connect ("", "", "")
Or Die ("Cannot connect to MySQL database". mysql_error ());
mysql_select_db ("Duyounet", $link);
mysql_query ("SET NAMES ' gb2312 '", $link);
$day 30=time () -60*60*24*30;
$result =mysql_query ("Select Articleid,articlename, (allvote*20+goodnum+allvisit) as dxy_px from Jieqi_article_ Article where postdate> $day the ORDER by dxy_px desc-Limit 0,14 ") or Die (" query ". $database." Database error ". Mysql_error ());
$row =mysql_fetch_row ($result);
echo "Document.writeln (\")
\")".";\ r\n ";
while ($row) {
echo "Document.writeln (\")
- ". $row [1]." (". $row [2].")
\ "); \ r \ n";
$row =mysql_fetch_row ($result);
}
Mysql_free_result ($result);
Mysql_close ();
echo "Document.writeln (\"
)
\ "); \ r \ n"
?>
SUBSTR ()
Take the month out + put it back in
There's a better way to do this, remember to tell me that I
hehe ~
Author: Sun Rain Release Date: 2005-4-13
If you are working in PHP, use Strtotime
[PHP]
$a = "2004/11/01";
$b =strtotime ("+6 months", strtotime ($a));
echo Date (' y/m/d ', $b);
[/php]
If you are working in MySQL, you can use the Date_add or Adddate function directly, or the interval keyword
Such as:
1. Select "2004-11-01" + INTERVAL 6 month;//The Date field can be used directly in 2004-10-01
2, select Date_add ("2004-11-01", INTERVAL 6 MONTH);
The above describes the PHP reading within 30 days according to the algorithm sort of code, including the content, I hope the PHP tutorial interested in a friend helpful.