"; print ""; print ""; } print "


Hot Topic
Welcome Snack
Some feedback

 

F A Q
[ all question about the course ]
[ -> Add a question here ]

"; while($row = mysql_fetch_array($table)) { $r_no = $row["no"]; $r_question = htmlspecialchars($row["question"]); // use the wordwrap to prevent text over table $r_question = wordwrap( $r_question, 80 ); $r_question = str_replace(" " ," " , $r_question); $r_question = str_replace(chr(13) ,"
" , $r_question); if($r_no % 2) { print "

"; } else { print "
"; } print "$r_question"; if(($mypermission >= 5) and ($r_answer == NULL)) { print " -> Answer this question"; } print "


"; $SQL = "SELECT * FROM qa ORDER BY no"; $table = mysql_query($SQL,$Conn) or die ("Unable to read table QA"); while($row = mysql_fetch_array($table)) { $r_no = $row["no"]; $r_name = $row["name"]; $r_email = htmlspecialchars($row["email"]); $r_country = $row["country"]; $r_city = $row["city"]; $r_stamp = $row["stamp"]; //แปลงข้อมูลที่ผู้แสดงความคิดเห็นกรอกให้สามารถ //แสดงเครื่องหมายพิเศษในภาษา HTML $r_question = htmlspecialchars($row["question"]); $r_answer = htmlspecialchars($row["answer"]); // use the wordwrap to prevent text over table $r_question = wordwrap( $r_question, 80 ); $r_answer = wordwrap( $r_answer, 80 ); //แปลงช่องว่างที่แสดงความคิดเห็นกรรอกให้เป็น   $r_question = str_replace(" " ," " , $r_question); $r_answer = str_replace(" " ," " , $r_answer); //แปลงรหัส ASCII ของการขึ้นบรรทัดใหม่ //ให้เป็นแท็ก
แทน $r_question = str_replace(chr(13) ,"
" , $r_question); $r_answer = str_replace(chr(13) ,"
" , $r_answer); // show each question and answer print ""; print(""); print ""; print ""; print ""; print ""; // print "From: $r_name $r_country/$r_city <$r_email>
$r_stamp

"; // if($r_answer <> NULL) { // print "From: Baan Thai Cooking School"; // } // print ""; print "
Q:$r_question"; if($mypermission >= 5) { print " -> Answer this question"; } print "
A:
"; print "
$r_answer
TOP

"; } include("EndConnect.inc"); ?>