SlideShare a Scribd company logo
PHP
Webboard
Tables and files
• 2 Tables(Webboard and Reply)
• Webboard.php for show all question
• NewQuestion.php for creating new question
• ViewWebboard.php for show question ,replies and create new
reply
• And include.php for connect database
CREATE TABLE Webboard
CREATE TABLE `webboard` (
`QuestionID` int(5) unsigned zerofill NOT NULL auto_increment,
`CreateDate` datetime NOT NULL,
`Question` varchar(255) NOT NULL,
`Details` text NOT NULL,
`Name` varchar(50) NOT NULL,
`View` int(5) NOT NULL,
`Reply` int(5) NOT NULL,
PRIMARY KEY (`QuestionID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
CREATE TABLE Reply
CREATE TABLE `reply` (
`ReplyID` int(5) unsigned zerofill NOT NULL auto_increment,
`QuestionID` int(5) unsigned zerofill NOT NULL,
`CreateDate` datetime NOT NULL,
`Details` text NOT NULL,
`Name` varchar(50) NOT NULL,
PRIMARY KEY (`ReplyID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
Webboard.php
<html>
<body>
<a href="NewQuestion.php">New Topic</a>
<?
include ("include.php");
$strSQL = "SELECT * FROM webboard ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);
$Per_Page = 10; // Per Page
$Page = $_GET["Page"];
if(!$_GET["Page"])
{ $Page=1; }
$Prev_Page = $Page-1;
$Next_Page = $Page+1;
$Page_Start = (($Per_Page*$Page)-$Per_Page);
if($Num_Rows<=$Per_Page)
{ $Num_Pages =1; }
else if(($Num_Rows % $Per_Page)==0)
{ $Num_Pages =($Num_Rows/$Per_Page) ; }
else
{ $Num_Pages =($Num_Rows/$Per_Page)+1;
$Num_Pages = (int)$Num_Pages;
}
$strSQL .=" order by QuestionID DESC LIMIT $Page_Start ,
$Per_Page";
$objQuery = mysql_query($strSQL);
?>
<table width="909" border="1">
<tr>
<th width="99"> <div align="center">QuestionID</div></th>
<th width="458"> <div align="center">Question</div></th>
<th width="90"> <div align="center">Name</div></th>
<th width="130"> <div align="center">CreateDate</div></th>
<th width="45"> <div align="center">View</div></th>
<th width="47"> <div align="center">Reply</div></th>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td><div align="center"><?=$objResult["QuestionID"];?></div></td>
<td><a href= "ViewWebboard.php?QuestionID=<?
=$objResult["QuestionID"];?>"> <?=$objResult["Question"];?
></a></td>
<td><?=$objResult["Name"];?></td>
<td><div align="center"><?=$objResult["CreateDate"];?></div></td>
<td align="right"><?=$objResult["View"];?></td>
<td align="right"><?=$objResult["Reply"];?></td>
</tr>
<?
}
?>
</table>
<br>
Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page :
<?
if($Prev_Page)
{ echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><<
Back</a> ";
}
for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page)
{ echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]";
}
else
{ echo "<b> $i </b>";
}
}
if($Page!=$Num_Pages)
{ echo " <a href = '$_SERVER[SCRIPT_NAME]?
Page=$Next_Page'>Next>></a> ";
}
mysql_close();
?>
</body>
</html>
NewQuestion.php
<?
include ("include.php");
if($_GET["Action"] == "Save")
{ //*** Insert Question ***//
$strSQL = "INSERT INTO webboard ";
$strSQL .="(CreateDate,Question,Details,Name) ";
$strSQL .="VALUES ";
$strSQL .="('".date("Y-m-d H:i:s")."','".$_POST["txtQuestion"]."','".
$_POST["txtDetails"]."','".$_POST["txtName"]."') ";
$objQuery = mysql_query($strSQL);
header("location:Webboard.php");
}
?>
<html>
<body>
<form action="NewQuestion.php?Action=Save" method="post“
name="frmMain" id="frmMain">
<table width="621" border="1" cellpadding="1" cellspacing="1">
<tr>
<td>Question</td>
<td><input name="txtQuestion" type="text" id="txtQuestion"
value="" size="70"></td>
</tr>
<tr>
<td width="78">Details</td>
<td><textarea name="txtDetails" cols="50" rows="5"
id="txtDetails"></textarea></td>
</tr>
<tr>
<td width="78">Name</td>
<td width="647"><input name="txtName" type="text"
id="txtName" value="" size="50"></td>
</tr>
</table>
<input name="btnSave" type="submit" id="btnSave"
value="Submit">
</form>
</body>
</html>
<?
mysql_close();
?>
ViewWebboard.php
<?
include ("include.php");
if($_GET["Action"] == "Save")
{ //*** Insert Reply ***//
$strSQL = "INSERT INTO reply ";
$strSQL .="(QuestionID,CreateDate,Details,Name) ";
$strSQL .="VALUES ";
$strSQL .="('".$_GET["QuestionID"]."','".date("Y-m-d H:i:s")."','".
$_POST["txtDetails"]."','".$_POST["txtName"]."') ";
$objQuery = mysql_query($strSQL);
//*** Update Reply ***//
$strSQL = "UPDATE webboard ";
$strSQL .="SET Reply = Reply + 1 WHERE QuestionID = '".
$_GET["QuestionID"]."' ";
$objQuery = mysql_query($strSQL);
}
?>
<html>
<body>
<?
//*** Select Question ***//
$strSQL = "SELECT * FROM webboard WHERE QuestionID = '".
$_GET["QuestionID"]."' ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$objResult = mysql_fetch_array($objQuery);
//*** Update View ***//
$strSQL = "UPDATE webboard ";
$strSQL .="SET View = View + 1 WHERE QuestionID = '".
$_GET["QuestionID"]."' ";
$objQuery = mysql_query($strSQL);
?>
<table width="738" border="1" cellpadding="1" cellspacing="1">
<tr>
<td colspan="2"><center><h1><?=$objResult["Question"];?
></h1></center></td>
</tr>
<tr>
<td height="53" colspan="2"><?=nl2br($objResult["Details"]);?
></td>
</tr>
<tr>
<td width="397">Name : <?=$objResult["Name"];?> Create Date : <?
=$objResult["CreateDate"];?></td>
<td width="253">View : <?=$objResult["View"];?> Reply : <?
=$objResult["Reply"];?></td>
</tr>
</table>
<br>
<br>
<?
$intRows = 0;
$strSQL2 = "SELECT * FROM reply WHERE QuestionID = '".
$_GET["QuestionID"]."' ";
$objQuery2 = mysql_query($strSQL2) or die ("Error Query [".
$strSQL."]");
while($objResult2 = mysql_fetch_array($objQuery2))
{ $intRows++;
?> No : <?=$intRows;?>
<table width="738" border="1" cellpadding="1" cellspacing="1">
<tr>
<td height="53" colspan="2"><?=nl2br($objResult2["Details"]);?
></td>
</tr>
<tr>
<td width="397">Name :
<?=$objResult2["Name"];?> </td>
<td width="253">Create Date :
<?=$objResult2["CreateDate"];?></td>
</tr>
</table><br>
<?
}
?>
<br>
<a href="Webboard.php">Back to Webboard</a> <br>
<br>
<form action="ViewWebboard.php?QuestionID=<?
=$_GET["QuestionID"];?>&Action=Save" method="post"
name="frmMain" id="frmMain">
<table width="738" border="1" cellpadding="1" cellspacing="1">
<tr>
<td width="78">Details</td>
<td><textarea name="txtDetails" cols="50" rows="5"
id="txtDetails"></textarea></td>
</tr>
<tr>
<td width="78">Name</td>
<td width="647"><input name="txtName" type="text"
id="txtName" value="" size="50"></td>
</tr>
</table>
<input name="btnSave" type="submit" id="btnSave"
value="Submit">
</form>
</body>
</html>
<?
mysql_close();
?>
Include.php
<?
mysql_connect("localhost","root","1234");
mysql_select_db("test");
?>

More Related Content

PPT
PHP cart
PDF
Separation of concerns - DPC12
PPT
Propel sfugmd
PDF
Dig Deeper into WordPress - WD Meetup Cairo
PPTX
Web весна 2013 лекция 6
PPTX
Web осень 2012 лекция 6
DOC
PDF
php plus mysql
PHP cart
Separation of concerns - DPC12
Propel sfugmd
Dig Deeper into WordPress - WD Meetup Cairo
Web весна 2013 лекция 6
Web осень 2012 лекция 6
php plus mysql

What's hot (17)

PPTX
CakePHP workshop
PDF
jQuery%20on%20Rails%20Presentation
DOCX
Sql
PDF
Gareth hayes. non alphanumeric javascript-php and shared fuzzing
PDF
Everything About PowerShell
KEY
Introduction à CoffeeScript pour ParisRB
PDF
Everything you always wanted to know about forms* *but were afraid to ask
PDF
R57shell
PPT
MySQLConf2009: Taking ActiveRecord to the Next Level
PPTX
Open Source Search: An Analysis
PDF
Groovy kind of test
PDF
Solr's Search Relevancy (Understand Solr's query debug)
PDF
Webmontag Berlin "coffee script"
PDF
PhoneGap: Local Storage
PDF
PHP tips and tricks
KEY
Potential Friend Finder
PDF
The Ring programming language version 1.5.2 book - Part 66 of 181
CakePHP workshop
jQuery%20on%20Rails%20Presentation
Sql
Gareth hayes. non alphanumeric javascript-php and shared fuzzing
Everything About PowerShell
Introduction à CoffeeScript pour ParisRB
Everything you always wanted to know about forms* *but were afraid to ask
R57shell
MySQLConf2009: Taking ActiveRecord to the Next Level
Open Source Search: An Analysis
Groovy kind of test
Solr's Search Relevancy (Understand Solr's query debug)
Webmontag Berlin "coffee script"
PhoneGap: Local Storage
PHP tips and tricks
Potential Friend Finder
The Ring programming language version 1.5.2 book - Part 66 of 181
Ad

Viewers also liked (20)

PPTX
Dairy project presentation usaid cwg
RTF
new david resume
DOC
Cartaz cça
PDF
Programming Without Coding Technology (PWCT) - Date Picker control
PPT
Violencedomestique
DOCX
PPTX
Palestra de Paulo Dias
DOCX
Les catherinettes cartaz (1)
PDF
Argentina territorial.[03] frontera norte [vig terrestre]2do nivel
DOCX
Khaled Elkaramany CV
PPS
Poetui justinui marcinkeviciui_atminti
DOC
Uuff conocimiento aplicado 4º
PDF
CCNA LAN Switching
PPT
Dod matrimony ppt
PPT
Dod matrimony ppt 2
PDF
Being functional in PHP
PPTX
Programació mitjans
DOCX
Matrimonial web site Documentation
PDF
Enttäuschungen
 
Dairy project presentation usaid cwg
new david resume
Cartaz cça
Programming Without Coding Technology (PWCT) - Date Picker control
Violencedomestique
Palestra de Paulo Dias
Les catherinettes cartaz (1)
Argentina territorial.[03] frontera norte [vig terrestre]2do nivel
Khaled Elkaramany CV
Poetui justinui marcinkeviciui_atminti
Uuff conocimiento aplicado 4º
CCNA LAN Switching
Dod matrimony ppt
Dod matrimony ppt 2
Being functional in PHP
Programació mitjans
Matrimonial web site Documentation
Enttäuschungen
 
Ad

Similar to PHP webboard (20)

PDF
Html , php, mysql intro
PDF
PHP an intro -1
DOC
Ex[1].3 php db connectivity
PPT
PHP up file
PDF
php-mysql-tutorial-part-3
PDF
php-mysql-tutorial-part-3
PDF
&lt;b>PHP&lt;/b>/MySQL &lt;b>Tutorial&lt;/b> webmonkey/programming/
PDF
&lt;img src="../i/r_14.png" />
PPTX
Lecture 8 PHP and MYSQL part 2.ppType Classificationtx
ODP
Google Cloud Challenge - PHP - DevFest GDG-Cairo
PPTX
PHP DATABASE MANAGEMENT.pptx
PPTX
Quick beginner to Lower-Advanced guide/tutorial in PHP
PDF
The HyperText Markup Language or HTML is the standard markup language
PPTX
This slide show will brief about database handling
PPTX
Coding for php with mysql
PDF
Diving into php
PPTX
Amp and higher computing science
PDF
Please include new php files I need or changes to current files- do I.pdf
PDF
Php code for online quiz
PDF
SULTHAN's - PHP MySQL programs
Html , php, mysql intro
PHP an intro -1
Ex[1].3 php db connectivity
PHP up file
php-mysql-tutorial-part-3
php-mysql-tutorial-part-3
&lt;b>PHP&lt;/b>/MySQL &lt;b>Tutorial&lt;/b> webmonkey/programming/
&lt;img src="../i/r_14.png" />
Lecture 8 PHP and MYSQL part 2.ppType Classificationtx
Google Cloud Challenge - PHP - DevFest GDG-Cairo
PHP DATABASE MANAGEMENT.pptx
Quick beginner to Lower-Advanced guide/tutorial in PHP
The HyperText Markup Language or HTML is the standard markup language
This slide show will brief about database handling
Coding for php with mysql
Diving into php
Amp and higher computing science
Please include new php files I need or changes to current files- do I.pdf
Php code for online quiz
SULTHAN's - PHP MySQL programs

More from tumetr1 (20)

PDF
ตัวอย่างประวัติผู้วิจัย เล่มโปรเจ็ค
PDF
ตัวอย่างภาคผนวก เล่มโปรเจ็ค
PDF
ตัวอย่างบรรณานุกรม เล่มโปรเจ็ค
PDF
ตัวอย่างบทที่1 บทนำ เล่มโปรเจ็ค
PDF
ตัวอย่างสารบัญ เล่มโปรเจ็ค
PDF
ตัวอย่างกิตติกรรมประกาศ เล่มโปรเจ็ค
PDF
ตัวอย่างบทคัดย่อเล่มโปรเจ็ค
PPT
file transfer and access utilities
PPT
retrieving the mail
PPT
connectivity utility
PPT
network hardware
PPT
ระบบเครือข่ายไร้สาย (wireless lan)
PPT
routing
PPT
the transport layer
PPT
ระดับชั้นเน็ตเวิร์ก
PPT
ระดับชั้นดาต้าลิงค์
PPT
สถาปัตยกรรมเครือข่ายคอมพิวเตอร์และบริการ
PPT
การส่งข้อมูลผ่านสายส่งและเทคนิคการส่งข้อมูลผ่านเครือข่าย
PPT
ความรู้พื้นฐานของระบบการสื่อสารข้อมูล
PPT
พัฒนาเศรษฐกิจ
ตัวอย่างประวัติผู้วิจัย เล่มโปรเจ็ค
ตัวอย่างภาคผนวก เล่มโปรเจ็ค
ตัวอย่างบรรณานุกรม เล่มโปรเจ็ค
ตัวอย่างบทที่1 บทนำ เล่มโปรเจ็ค
ตัวอย่างสารบัญ เล่มโปรเจ็ค
ตัวอย่างกิตติกรรมประกาศ เล่มโปรเจ็ค
ตัวอย่างบทคัดย่อเล่มโปรเจ็ค
file transfer and access utilities
retrieving the mail
connectivity utility
network hardware
ระบบเครือข่ายไร้สาย (wireless lan)
routing
the transport layer
ระดับชั้นเน็ตเวิร์ก
ระดับชั้นดาต้าลิงค์
สถาปัตยกรรมเครือข่ายคอมพิวเตอร์และบริการ
การส่งข้อมูลผ่านสายส่งและเทคนิคการส่งข้อมูลผ่านเครือข่าย
ความรู้พื้นฐานของระบบการสื่อสารข้อมูล
พัฒนาเศรษฐกิจ

Recently uploaded (20)

PDF
Basic Mud Logging Guide for educational purpose
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Lesson notes of climatology university.
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
master seminar digital applications in india
PDF
Classroom Observation Tools for Teachers
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
Pharma ospi slides which help in ospi learning
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
Microbial diseases, their pathogenesis and prophylaxis
Basic Mud Logging Guide for educational purpose
2.FourierTransform-ShortQuestionswithAnswers.pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Lesson notes of climatology university.
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
human mycosis Human fungal infections are called human mycosis..pptx
PPH.pptx obstetrics and gynecology in nursing
TR - Agricultural Crops Production NC III.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
master seminar digital applications in india
Classroom Observation Tools for Teachers
STATICS OF THE RIGID BODIES Hibbelers.pdf
Pharma ospi slides which help in ospi learning
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Renaissance Architecture: A Journey from Faith to Humanism
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Microbial diseases, their pathogenesis and prophylaxis

PHP webboard

  • 2. Tables and files • 2 Tables(Webboard and Reply) • Webboard.php for show all question • NewQuestion.php for creating new question • ViewWebboard.php for show question ,replies and create new reply • And include.php for connect database
  • 3. CREATE TABLE Webboard CREATE TABLE `webboard` ( `QuestionID` int(5) unsigned zerofill NOT NULL auto_increment, `CreateDate` datetime NOT NULL, `Question` varchar(255) NOT NULL, `Details` text NOT NULL, `Name` varchar(50) NOT NULL, `View` int(5) NOT NULL, `Reply` int(5) NOT NULL, PRIMARY KEY (`QuestionID`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
  • 4. CREATE TABLE Reply CREATE TABLE `reply` ( `ReplyID` int(5) unsigned zerofill NOT NULL auto_increment, `QuestionID` int(5) unsigned zerofill NOT NULL, `CreateDate` datetime NOT NULL, `Details` text NOT NULL, `Name` varchar(50) NOT NULL, PRIMARY KEY (`ReplyID`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
  • 5. Webboard.php <html> <body> <a href="NewQuestion.php">New Topic</a> <? include ("include.php"); $strSQL = "SELECT * FROM webboard "; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); $Num_Rows = mysql_num_rows($objQuery); $Per_Page = 10; // Per Page $Page = $_GET["Page"];
  • 6. if(!$_GET["Page"]) { $Page=1; } $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_Start = (($Per_Page*$Page)-$Per_Page); if($Num_Rows<=$Per_Page) { $Num_Pages =1; } else if(($Num_Rows % $Per_Page)==0) { $Num_Pages =($Num_Rows/$Per_Page) ; } else { $Num_Pages =($Num_Rows/$Per_Page)+1; $Num_Pages = (int)$Num_Pages; } $strSQL .=" order by QuestionID DESC LIMIT $Page_Start , $Per_Page";
  • 7. $objQuery = mysql_query($strSQL); ?> <table width="909" border="1"> <tr> <th width="99"> <div align="center">QuestionID</div></th> <th width="458"> <div align="center">Question</div></th> <th width="90"> <div align="center">Name</div></th> <th width="130"> <div align="center">CreateDate</div></th> <th width="45"> <div align="center">View</div></th> <th width="47"> <div align="center">Reply</div></th> </tr> <? while($objResult = mysql_fetch_array($objQuery)) { ?>
  • 8. <tr> <td><div align="center"><?=$objResult["QuestionID"];?></div></td> <td><a href= "ViewWebboard.php?QuestionID=<? =$objResult["QuestionID"];?>"> <?=$objResult["Question"];? ></a></td> <td><?=$objResult["Name"];?></td> <td><div align="center"><?=$objResult["CreateDate"];?></div></td> <td align="right"><?=$objResult["View"];?></td> <td align="right"><?=$objResult["Reply"];?></td> </tr> <? } ?> </table> <br>
  • 9. Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page : <? if($Prev_Page) { echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</a> "; } for($i=1; $i<=$Num_Pages; $i++){ if($i != $Page) { echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]"; } else { echo "<b> $i </b>"; } }
  • 10. if($Page!=$Num_Pages) { echo " <a href = '$_SERVER[SCRIPT_NAME]? Page=$Next_Page'>Next>></a> "; } mysql_close(); ?> </body> </html>
  • 11. NewQuestion.php <? include ("include.php"); if($_GET["Action"] == "Save") { //*** Insert Question ***// $strSQL = "INSERT INTO webboard "; $strSQL .="(CreateDate,Question,Details,Name) "; $strSQL .="VALUES "; $strSQL .="('".date("Y-m-d H:i:s")."','".$_POST["txtQuestion"]."','". $_POST["txtDetails"]."','".$_POST["txtName"]."') "; $objQuery = mysql_query($strSQL); header("location:Webboard.php"); }
  • 12. ?> <html> <body> <form action="NewQuestion.php?Action=Save" method="post“ name="frmMain" id="frmMain"> <table width="621" border="1" cellpadding="1" cellspacing="1"> <tr> <td>Question</td> <td><input name="txtQuestion" type="text" id="txtQuestion" value="" size="70"></td> </tr> <tr> <td width="78">Details</td> <td><textarea name="txtDetails" cols="50" rows="5" id="txtDetails"></textarea></td> </tr>
  • 13. <tr> <td width="78">Name</td> <td width="647"><input name="txtName" type="text" id="txtName" value="" size="50"></td> </tr> </table> <input name="btnSave" type="submit" id="btnSave" value="Submit"> </form> </body> </html> <? mysql_close(); ?>
  • 14. ViewWebboard.php <? include ("include.php"); if($_GET["Action"] == "Save") { //*** Insert Reply ***// $strSQL = "INSERT INTO reply "; $strSQL .="(QuestionID,CreateDate,Details,Name) "; $strSQL .="VALUES "; $strSQL .="('".$_GET["QuestionID"]."','".date("Y-m-d H:i:s")."','". $_POST["txtDetails"]."','".$_POST["txtName"]."') "; $objQuery = mysql_query($strSQL);
  • 15. //*** Update Reply ***// $strSQL = "UPDATE webboard "; $strSQL .="SET Reply = Reply + 1 WHERE QuestionID = '". $_GET["QuestionID"]."' "; $objQuery = mysql_query($strSQL); } ?> <html> <body> <? //*** Select Question ***// $strSQL = "SELECT * FROM webboard WHERE QuestionID = '". $_GET["QuestionID"]."' "; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); $objResult = mysql_fetch_array($objQuery);
  • 16. //*** Update View ***// $strSQL = "UPDATE webboard "; $strSQL .="SET View = View + 1 WHERE QuestionID = '". $_GET["QuestionID"]."' "; $objQuery = mysql_query($strSQL); ?> <table width="738" border="1" cellpadding="1" cellspacing="1"> <tr> <td colspan="2"><center><h1><?=$objResult["Question"];? ></h1></center></td> </tr> <tr> <td height="53" colspan="2"><?=nl2br($objResult["Details"]);? ></td> </tr>
  • 17. <tr> <td width="397">Name : <?=$objResult["Name"];?> Create Date : <? =$objResult["CreateDate"];?></td> <td width="253">View : <?=$objResult["View"];?> Reply : <? =$objResult["Reply"];?></td> </tr> </table> <br> <br> <? $intRows = 0; $strSQL2 = "SELECT * FROM reply WHERE QuestionID = '". $_GET["QuestionID"]."' "; $objQuery2 = mysql_query($strSQL2) or die ("Error Query [". $strSQL."]");
  • 18. while($objResult2 = mysql_fetch_array($objQuery2)) { $intRows++; ?> No : <?=$intRows;?> <table width="738" border="1" cellpadding="1" cellspacing="1"> <tr> <td height="53" colspan="2"><?=nl2br($objResult2["Details"]);? ></td> </tr> <tr> <td width="397">Name : <?=$objResult2["Name"];?> </td> <td width="253">Create Date : <?=$objResult2["CreateDate"];?></td> </tr> </table><br>
  • 19. <? } ?> <br> <a href="Webboard.php">Back to Webboard</a> <br> <br> <form action="ViewWebboard.php?QuestionID=<? =$_GET["QuestionID"];?>&Action=Save" method="post" name="frmMain" id="frmMain"> <table width="738" border="1" cellpadding="1" cellspacing="1"> <tr> <td width="78">Details</td> <td><textarea name="txtDetails" cols="50" rows="5" id="txtDetails"></textarea></td> </tr>
  • 20. <tr> <td width="78">Name</td> <td width="647"><input name="txtName" type="text" id="txtName" value="" size="50"></td> </tr> </table> <input name="btnSave" type="submit" id="btnSave" value="Submit"> </form> </body> </html> <? mysql_close(); ?>