Imitating OSO's Forum (2) _ php Basics

Source: Internet
Author: User
Tags php basics
Imitating OSO forums (2) read. php (used to display related topics)
Problem

























If ($ row ['answer _ count']> 5){Echo" ";$ This_id = $ row ['id'];$ Query = "select id from guestbook where id <". $ this_id. "and type = 1 order by id DESC ";$ Res = mysql_query ($ query );$ Row = mysql_fetch_row ($ res );$ Pre_id = $ row [0];$ Query = "select id from guestbook where id>". $ this_id. "and type = 1 order by id ";$ Res = mysql_query ($ query );$ Row = mysql_fetch_row ($ res );$ Next_id = $ row [0];?>
Subject: color = #993333>
Include "connect. inc. php ";
$ Query = "select * from guestbook where id =". $ theme_id;
$ Res = mysql_query ($ query );
$ Row = mysql_fetch_array ($ res );
Echo $ row ['theme '];
?>
Href = "post. php"> border = 0 src = "mypic/post.gif">
"> Border = 0
Src = "mypic/reply.gif"> href = "faq. php? Page = 1 "> border = 0
Src = "mypic/theme.gif">
Page :";
For ($ j = 1; $ j <= ($ row ['answer _ count']-1)/5 + 1; $ j ++ ){
If ($ j = $ page) echo "[". $ j. "]";
Else echo "";
}}
Echo "a total of posts". $ row ['answer _ count ']."





























$ Query = "select * from guestbook where main_id = ". $ theme_id. "or id = ". $ theme_id. "order by time_open DESC limit ". strval ($ page-1) * 5 ). ", 5 ";$ Res = mysql_query ($ query );Function TdBackColor (){Static $ ColorStr;If ($ ColorStr = "# ededed "){$ ColorStr = "# dedede ";} Else {$ ColorStr = "# ededed ";}Return ($ ColorStr );}For ($ I = 1; $ I <= 5; $ I ++){$ Row = @ mysql_fetch_array ($ res );If (! $ Row) break;$ ColorStr = TdBackColor ();Echo" ";Echo" ";Echo" ";Echo" ";}?>
Work
By
Internal
Capacity
Echo "class = mid>";
Echo $ row ['name']."
";
Echo"






";Echo" ";Echo" ";Echo" ";Echo" ";Echo" ";Echo" ";Echo"
Echo "src = 'mypic/icon". $ row ['Icon ']. ". gif'>Posted on: ". $ row ['time _ open']."
";
Echo" ";
Echo"
". $ Row ['content']."
Href = "read. php? Theme_id = & Page = 1 "> color = # ffffff> previous topic href =" read. php? Theme_id = & Page = 1 "> color = # ffffff> next topic





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.