|
|
|
อยากสอบถามเรื่อง webboard ที่เขียนการตอบด้วย ajax ในการแสดงการตอบกระทู้ |
|
|
|
|
|
|
|
ok ผมทำให้มัน realtime ได้แล้วแต่พอจะมีวิธีทำให้มันอยู่ด้านบนรึป่าวครับแบบว่า ข้อมูลแสดงด้านบน ส่วน form ในการกรอกข้อมูลอยู่ด้านล่าง
Code (PHP)
<div class="answer" style="height:120px">
<div class="answer1" style="height:25px" align="left">เรื่อง<?="$title?"?>
</div>
<table class="answer2" align="center" width="100" height="25%">
<tr>
<td width="10%" height="73" align="left" valign="top"><p>
<?
if($photo=$photo){
echo"<img src='bg/guest.jpg' align='top'>";
}else{
echo"<img src='bg/guest.jpg' align='top'>";
}
?></td>
<td width="90%" align="left" valign="top" class="white"><p><font class="yellow"><? echo "$detail" ?></font>
<p>
<br />
กระทู้ของ
<span class="style1"><? echo"$user" ?> </span> วันที่ <span class="style1"><? echo"$date" ?> </span> จำนวนผู้อ่าน <span class="style1"><? echo"$read" ?> </span> จำนวนผู้ตอบ <span class="style1"><? echo"$reply" ?> </span> <? echo"<img src='bg/icon_face.gif' align='absmiddle' "?></td>
<body Onload="JavaScript:doCallAjax('LIST');">
</table>
</div>
<br />
<br />
<form name="frmMain" id="frmMain">
<div class="bg2"><font class="white">RE.แสดงความคิดเห็น</font></div>
<div class="bg1">
<table height="95"width="464">
<tr>
<td width="94" height="39" align="left"><font class="yellow"> - Comment ** </font></td>
<td width="358" align="left"><textarea name="detail" cols="35" id="detail"></textarea></td>
<tr>
<td height="23" align="left"><font class="yellow">- Username ** </font></td>
<td align="left"><input name="use" type="text" id="use" size="40" /></td>
<tr>
<td height="23" align="left"><font class="yellow">- Email address **</font></td>
<td align="left"><input name="email" type="text" id="email" size="40" />
<input name="btn" type="button" id="Submit" value="comment" onclick="javascript:doCallAjax('ADD');" />
<span class="b1">
<input name="post" type="hidden" id="post" value="<?=$pid?>" />
</span> </td>
</table>
</div>
<span id="mySpan"></span>
</form>
<p>
<table width="765" height="25" align="center">
<tr>
<td width="757" align="center" class="a"><span class="style23"><span class="b1"><img src="bg/goggen.php.gif" width="14" height="17" /> </span></span><span class="white">Copyright <strong>©</strong> 2011 webmaster by TS webboard online . All rights reserved.</span></td>
</tr>
</table>
หน้าบันทึก
Code (PHP)
<style type="text/css">
<!--
.answer3 {font:Tahoma; size:13px;
border:rgb(200,200,200) solid 1px;
width:75%;
margin:0em auto;
background:;
-webkit-border-radius: 15 px;
-moz-border-radius: 15px;
border-radius: 2px;
-moz-box-shadow:0 0 10px #B6BDC4;
-webkit-box-shadow:0 0 10px #B6BDC4;
box-shadow: 0 0 15px #FFFFFF ;
padding::10px;
}
</style>
<?
date_default_timezone_set('asia/Bangkok');
include"connect.php";
$strMode = $_POST["tMode"];
$pid=$_REQUEST['tpid'];
$detail=$_POST['tdetail'];
$use=$_POST['tuse'];
$email=$_POST['temail'];
$date=date("Y-m-d H:i:s");
$sql1="update tb_post set p_post=p_post +1 where p_id='$pid' ";
$result1=mysql_query($sql1);
$sql2="update tb_post set p_status='a',user_post='Guest' where p_id='$pid' ";
$result2=mysql_query($sql2);
////--------------------เก็บรหัสสินค้าเป็นรหัส------------------************
if($strMode == "ADD"){
$sql = "SELECT r_id FROM tb_reply ORDER BY r_id DESC LIMIT 1";
$result = mysql_query($sql);
if(mysql_num_rows($result) > 0)
{
$row = mysql_fetch_array($result);
sscanf($row[0] ,"0%d" , $id);
$id++;
$sql = "INSERT INTO tb_reply VALUES(CONCAT('0',RIGHT(CONCAT('0000' , $id) , 4)),'$detail','$use','$email','$date','$pid')";
}
else
{
$sql = "INSERT INTO tb_reply VALUES('00001','$detail','$use','$email','$date','$pid')";
}
}
mysql_query($sql);
?>
<?
$sqlreply="select * from tb_reply where pid='$pid' order by r_id desc "; // ****** ดึงข้อมูลการ post ขึ้นมาโชว์
$rss=mysql_query($sqlreply);
while($rs1=mysql_fetch_array($rss)){
$detailr=$rs1['r_detail'];
$use1r=$rs1['r_use'];
$date1r=$rs1['r_date'];
?>
<table class="answer3" align="center" >
<tr>
<td width="10%" height="70" align="left" valign="top"><p>
<?
if($photo=$photo){
echo"<img src='mypic/$photo' align='top'>";
}else{
echo"<img src='bg/guest.jpg' align='top'>";
}
?>
</p></td>
<td width="90%" align="left" valign="top" class="white"><p><font class="yellow"><? echo "$detailr" ?></font> </p>
<p> <br />
กระทู้ของ
<span class="style1"><? echo"$use1r" ?> </span> วันที่ <span class="style1"><? echo"$date1r" ?></span><span class="style1"> </span> <? echo"<img src='bg/icon_face.gif' align='absmiddle' "?></p></td>
</tr>
<? } ?>
</table>
<?
mysql_close();
?>
|
|
|
|
|
Date :
2011-07-29 22:19:36 |
By :
chonburi f.c |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|