|
|
|
ช่วยดู Code ให้ผมหน่อยครับ ติดปัญหาครับเป็นหน้าแสดงรายละเอียดกระทู้ครับ |
|
|
|
|
|
|
|
ช่วยดู Code ให้ผมหน่อยครับ เหลือหน้านี้ครับเป็นหน้าแสดงรายละเอียดกระทู้ครับ ยังเป็นภาษาไทยปนกลับภาษาต่างดาว
<?
include "sell_connect.php";
include "sell_function.php";
$id_ques=$_GET[id_ques];
///////////////// ส่วนที่ 1 /////////////////
$sql="select * from tb_question where id_ques='$id_ques' ";
$result=mysql_db_query($dbname,$sql);
$record=mysql_fetch_array($result);
$id_ques=$record[id_ques];
$title_ques=$record[title_ques];
$detail_ques=$record[detail_ques];
$name_ques=$record[name_ques];
$email_ques=$record[email_ques];
$date_ques=$record[date_ques];
$picboard=$record[pic];
$picboard2=$record[pic2];
$picboard3=$record[pic3];
$picboard4=$record[pic4];
$picboard5=$record[pic5];
$view_ques=$record[view_ques];
$post_ques=$record[post_ques];
$title_ques=htmlspecialchars($title_ques);
$detail_ques=nl2br(htmlspecialchars($detail_ques));
$name_ques=htmlspecialchars($name_ques);
$email_ques=htmlspecialchars($email_ques);
$ip=$record[$ip];
//$date_ques=displaydate($date_ques);
$pic="<IMG SRC='images/smile.gif'>";
$detail_ques=str_replace(":)",$pic, $detail_ques);
$pic="<IMG SRC='images/open_mouthed_smile.gif'>";
$detail_ques=str_replace(":D",$pic, $detail_ques);
$pic="<IMG SRC='images/winking_smile.gif'>";
$detail_ques=str_replace(";)",$pic, $detail_ques);
$pic="<IMG SRC='images/sursprised_smile.gif'>";
$detail_ques=str_replace(":-O",$pic, $detail_ques);
$pic="<IMG SRC='images/smile_with_tongue_out.gif'>";
$detail_ques=str_replace(":P",$pic, $detail_ques);
$pic="<IMG SRC='images/hot_smile.gif'>";
$detail_ques=str_replace("(H)",$pic, $detail_ques);
$pic="<IMG SRC='images/angry_smile.gif'>";
$detail_ques=str_replace(":@",$pic, $detail_ques);
$pic="<IMG SRC='images/confused_smile.gif'>";
$detail_ques=str_replace(":S",$pic, $detail_ques);
$pic="<IMG SRC='images/embarrassed_smile.gif'>";
$detail_ques=str_replace(":$",$pic, $detail_ques);
$pic="<IMG SRC='images/sad_smile.gif'>";
$detail_ans=str_replace(":(",$pic, $detail_ques);
$sql = "UPDATE tb_question SET view_ques = view_ques + 1
WHERE id_ques = $id_ques;";
@mysql_query($sql) or die(mysql_error());
$text = $title_ques;
$title_ques = wordwrap($text, 20, "\n", 1);
$text2 = $detail_ques;
$detail_ques = wordwrap($text2, 30, "\n", 1);
if ($picboard==""){
}
else { echo " <img src=photosell/$picboard><br><hr> ";
}
if ($picboard2==""){
}
else { echo " <img src=photosell/$picboard2><br><hr> ";
}
if ($picboard3==""){
}
else { echo " <img src=photosell/$picboard3><br><hr> ";
}
if ($picboard4==""){
}
else { echo " <img src=photosell/$picboard4><br><hr> ";
}
if ($picboard5==""){
}
else { echo " <img src=photosell/$picboard5><br><hr> ";
}
echo "
<h2>$title_ques</h2>
<table width=670' border='0'>
<tr>
<td bgcolor='#FFFFFF'><br>
<font size='2' face='Tahoma'>
<center>
$detail_ques</center>
<p><b>โดย :</b> $name_ques <img src=logo/ip.jpg> $ip
<img width=18 height=18 src=logo/view.jpg />view<align=center> $view_ques
<img width=15 height=15 src=logo/comment.gif />post<align=center> $post_ques
<b>เมื่อ :</b> $date_ques
<a href='sell_question_del.php?id_ques=$id_ques'> [ Delete ] </a><a href='sell_question_del.php?id_ques=$id_ques'> [ แก้ไข ] </a></p></font></td>
</tr>
</table>";
///////////////// ส่วนที่ 2 /////////////////
$sql="select * from tb_answer where ref_id='$id_ques' order by id_ans";
$result=mysql_db_query($dbname,$sql);
while($record=mysql_fetch_array($result)) {
$id_ans=$record[id_ans];
$detail_ans=$record[detail_ans];
$name_ans=$record[name_ans];
$email_ans=$record[email_ans];
$date_ans=$record[date_ans];
$ref_id=$record[ref_id];
$ip_ans=$record[ip_ans];
$detail_ans=nl2br(htmlspecialchars($detail_ans));
$name_ans=htmlspecialchars($name_ans);
$email_ans=htmlspecialchars($email_ans);
//$date_ans=displaydate($date_ans);
$pic="<IMG SRC='images/smile.gif'>";
$detail_ans=str_replace(":)",$pic, $detail_ans);
$pic="<IMG SRC='images/open_mouthed_smile.gif'>";
$detail_ans=str_replace(":D",$pic, $detail_ans);
$pic="<IMG SRC='images/winking_smile.gif'>";
$detail_ans=str_replace(";)",$pic, $detail_ans);
$pic="<IMG SRC='images/sursprised_smile.gif'>";
$detail_ans=str_replace(":-O",$pic, $detail_ans);
$pic="<IMG SRC='images/smile_with_tongue_out.gif'>";
$detail_ans=str_replace(":P",$pic, $detail_ans);
$pic="<IMG SRC='images/hot_smile.gif'>";
$detail_ans=str_replace("(H)",$pic, $detail_ans);
$pic="<IMG SRC='images/angry_smile.gif'>";
$detail_ans=str_replace(":@",$pic, $detail_ans);
$pic="<IMG SRC='images/confused_smile.gif'>";
$detail_ans=str_replace(":S",$pic, $detail_ans);
$pic="<IMG SRC='images/embarrassed_smile.gif'>";
$detail_ans=str_replace(":$",$pic, $detail_ans);
$pic="<IMG SRC='images/sad_smile.gif'>";
$detail_ans=str_replace(":(",$pic, $detail_ans);
echo "
<table width=670' border='0'>
<tr>
<td bgcolor='#FFFFFF'><div class='mixcode'><font size='2' face='MS Sans Serif'>$detail_ans</font></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'><font size='2' face='Tahoma'>
ลําดับที่ : <img src=logo/post.jpg> ตอบโดย : $name_ans <img src=logo/ip.jpg> $ip_ans เมื่อ : $date_ans
<a href='sell_answer_del.php?&id_ques=$id_ques&id_ans=$id_ans'> [ Delete ] </a></div> <right><img src=logo/ip.gif>
บรรทึกการเข้า</right></font> </td>
</tr>
</table>";
} //end while
mysql_close($c);
///////////////// ส่วนที่ 3 /////////////////
?>
Tag : PHP
|
|
|
|
|
|
Date :
2011-07-10 21:05:20 |
By :
pp |
View :
17770 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<meta http-equiv=Content-Type content="text/html; charset=tis-620">
ลองquery ดูครับ
Code (PHP)
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("mydatabase");
mysql_query("SET NAMES TIS620");
|
|
|
|
|
Date :
2011-07-10 21:22:24 |
By :
taza678 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|