Imitating OSO forums (2) read. php (used to display related topics)
Problem
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"> |
If ($ row ['answer _ count']> 5){Echo"
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 ']." | ";$ 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];?>
Work By |
Internal Capacity |
$ 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 "class = mid>"; Echo $ row ['name']." | ";Echo"
"; Echo"
";Echo"
";Echo"
";Echo"
Echo "src = 'mypic/icon". $ row ['Icon ']. ". gif'> | ";Echo"
Posted on: ". $ row ['time _ open']." | ";Echo"
|
";Echo"
";Echo"
"; Echo" "; Echo" |
". $ Row ['content']." |
";Echo"
";}?>
|
Href = "read. php? Theme_id = & Page = 1 "> color = # ffffff> previous topic href =" read. php? Theme_id = & Page = 1 "> color = # ffffff> next topic |
|