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