Php desktop center (4) Data Display _ php instance

Source: Internet
Author: User
Php desktop center (4) Data display the last step is to display.
The following program is called Through parameters.
For example, php. php? Jpg = jpg
Jpg is the name of the table. Remember This. Otherwise, the program will fail and an error will be displayed.
You can change the following program. In this way, it will be more beautiful.
The following is the source program:

Display


Mysql_connect ("localhost", "username", "password") or die ("unable to connect to the database! ");
$ Query = "SELECT id, url, mess, fromx, url1, mess1, fromx1, url2, mess2, fromx2, url3, mess3, fromx3 from $ jpg ";
$ Result = mysql_db_query ("elong", $ query); // execute the query
$ Num = mysql_numrows ($ result );
$ Page = round ($ page );
$ Pagesize = 4;
If ($ page = 0 ){
$ Page = 1 ;}
Else {
$ Page = $ page ;}
$ Pagecount = ($ num)/$ pagesize;
$ Pagecount = ceil ($ pagecount );
?>
Printf ("homepage", $ PHP_SELF, 1 );
Printf ("Front page", $ PHP_SELF, $ page-1 );
} Else {
?> Homepage front page }
?>

Printf ("Back page", $ PHP_SELF, $ page + 1 );
Printf ("last page", $ PHP_SELF, $ pagecount );
} Else {?> Last page Page: / Page

If ($ num <> 0 ){
$ Pp = 0;
For ($ ipage = 0; $ ipage <$ pagesize; $ ipage ++ ){
$ I = ($ page-1) * $ pagesize + $ ipage;
If ($ I <$ num ){
$ Id = mysql_result ($ result, $ I, "id ");
$ Url = mysql_result ($ result, $ I, "url ");
$ Mess = mysql_result ($ result, $ I, "mess ");
$ Fromx = mysql_result ($ result, $ I, "fromx ");
$ Url1 = mysql_result ($ result, $ I, "url1 ");
$ Mess1 = mysql_result ($ result, $ I, "mess1 ");
$ Fromx1 = mysql_result ($ result, $ I, "fromx1 ");
$ Url2 = mysql_result ($ result, $ I, "url2 ");
$ Mess2 = mysql_result ($ result, $ I, "mess2 ");
$ Fromx2 = mysql_result ($ result, $ I, "fromx2 ");
$ Url3 = mysql_result ($ result, $ I, "url3 ");
$ Mess3 = mysql_result ($ result, $ I, "mess3 ");
$ Fromx3 = mysql_result ($ result, $ I, "fromx3 ");
$ Pp = $ pp + 1;
?>







"Target =" _ blank ">" width = "160" height = "120" border = "4"> "Target =" _ blank ">" width = "160" height = "120" border = "4"> "Target =" _ blank ">" width = "160" height = "120" border = "4"> "Target =" _ blank ">" width = "160" height = "120" border = "4">

}
}
}
?>
  Paging
      Printf ("homepage", $ PHP_SELF, 1 );
Printf ("Front page", $ PHP_SELF, $ page-1 );
} Else {
?> Homepage front page Printf ("Back page", $ PHP_SELF, $ page + 1 );
Printf ("last page", $ PHP_SELF, $ pagecount );
} Else {?> Last page Page: / Page

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.