Php reads the code sorted by algorithm within 30 days. Copy the code as follows :? Php $ linkmysql_connect (,) ordie (unable to connect to mysql database. mysql_error (); mysql_select_db (duyounet, $ link); mysql_query (SETNAMESgb2312
The code is as follows:
$ Link = mysql_connect ("","","")
Or die ("unable to connect to mysql database". mysql_error ());
Mysql_select_db ("duyounet", $ link );
Mysql_query ("set names 'gb2312 '", $ link );
$ Day30 = time ()-60*60*24*30;
$ Result = mysql_query ("select articleid, articlename, (allvote * 20 + goodnum + allvisit) as dxy_px from jieqi_article_article where postdate> $ day30 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 ()
Remove the month and put it back.
Even if there is a better way to do this, remember to tell me
Hey hey ~
Author: Sun rain Release date:
If it is processed in PHP, use strtotime
[Php]
$ A = "2004/11/01 ";
$ B = strtotime ("+ 6 months", strtotime ($ ));
Echo date ('Y/m/D', $ B );
[/Php]
If you use the DATE_ADD or ADDDATE functions for processing in mysql, you can also use the INTERVAL keyword directly.
For example:
1. SELECT "2004-11-01" + INTERVAL 6 MONTH; // you can directly use the date field 2004-10-01.
2. SELECT DATE_ADD ("2004-11-01", INTERVAL 6 MONTH );
The http://www.bkjia.com/PHPjc/318944.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/318944.htmlTechArticle code is as follows :? Php $ link = mysql_connect ("", "", "") ordie ("unable to connect to mysql database ". mysql_error (); mysql_select_db ("duyounet", $ link); mysql_query ("SETNAMES 'gb2312 '...