£µ ª - bc.msu.ac.th

36
109 ภาคผนวก

Transcript of £µ ª - bc.msu.ac.th

Page 1: £µ ª - bc.msu.ac.th

109

ภาคผนวก

Page 2: £µ ª - bc.msu.ac.th

110

ภาคผนวก ก

การตดตงโปรแกรม

Page 3: £µ ª - bc.msu.ac.th

111

โปรแกรม AppServ

1. ดบเบลคลกไฟล appserv-win32-x.x.x.exe เพอท าการตดตง จะปรากฏหนาจอตามรปท 1

ภาพท 1 ขนตอนการตดตงโปรแกรม AppServ 2. เขาสขนตอนเงอนไขการใชงานโปรแกรม โดยโปรแกรม AppServ ไดแจกจายในรปแบบ GNU License หากผตดตง อานเงอนไขตางๆ เสรจสนแลว หากยอมรบเงอนไขใหกด Next เพอเขาสการตดตงในขนตอไป แตหากวาไมยอมรบเงอนไข.ใหกด Cancel เพอออกจากการตดตงโปรแกรม AppServ ดงรปตวอยางท 2

Page 4: £µ ª - bc.msu.ac.th

112

ภาพท 2 แสดงรายละเอยดเงอนไขการ GNU License 3. เขาสขนตอนการเลอกปลายทางทตองการตดตง โดยคาเรมตนปลายทางทตดตงจะเปน C:AppServ หากตองการเปลยนปลายทางทตดตง ใหกด Browse แลวเลอกปลายทางทตองการ ตามรปท 3 เมอเลอกปลายทางเสรจสนใหกดปม Next เพอเขาสขนตอนการตดตงขนตอไป

Page 5: £µ ª - bc.msu.ac.th

113

ภาพท 3 เลอกปลายทางการตดตงโปรแกรม AppServ 4. เลอก Package Components ทตองการตดตง โดยคาเรมตนนนจะใหเลอกลงทก Package แตหากวาผใชงาน ตองการเลอกลงเฉพาะบาง Package กสามารถเลอกตามขอทตองการออก โดยรายละเอยดแตละ Package มดงน - Apache HTTP Server คอ โปรแกรมทท าหนาเปน Web Server - MySQL Database คอ โปรแกรมทท าหนาเปน Database Server - PHP Hypertext Preprocessor คอ โปรแกรมทท าหนาประมวลผลการท างานของภาษา PHP - phpMyAdmin คอ โปรแกรมทใชในการบรหารจดการฐานขอมล MySQL ผานเวบไซต เมอท าการเลอก Package ตามรปท 4 เรยบรอยแลว ใหกด Next เพอเขาสขนตอนการตดตงตอไป

Page 6: £µ ª - bc.msu.ac.th

114

ภาพท 4 เลอก Package Components ทตองการตดตง 5. ก าหนดคาคอนฟกของ Apache Web Server มอยดวยกนทงหมด 3 สวน ตามรปท 5 คอ Server Name คอชองส าหรบปอนขอมลชอ Web Server ของทานเชน www.appservnetwork.com Admin Email คอชองส าหรบปอนขอมล อเมลผดแลระบบ เชน [email protected] HTTP Port คอชองส าหรบระบ Port ทจะเรยกใชงาน Apache Web Server โดยทวไปแลว Protocol HTTP นนจะมคาหลกคอ 80 หากวาทานตองการหลกเลยงการใช Port 80 กสามารถแกไขได หากมการเปลยนแปลง Port การเขาใชงาน Web Server แลว ทกครงทเรยกใชงานเวบไซต จ าเปนทตองระบหมายเลข Port ดวย เชน หากเลอกใช Port 99 ในการเขาเวบไซตทกครงตองใช http://www.appservnetwork.com:99 จงจะสามารถเขาใชงานได

Page 7: £µ ª - bc.msu.ac.th

115

ภาพท 5 แสดงการก าหนดคาคอนฟกคา Apache Web Server 6. ก าหนดคาคอนฟกของ MySQL Database มอยดวยกนทงหมด 3 สวน ตามรปท 6 คอ Root Password คอชองส าหรบปอน รหสผานการเขาใชงานฐานขอมลของ Root หรอผดแลระบบ ทกครงทเขาใชงานฐานขอมลในลกษณะทเปนผดแลระบบ ใหระบ user คอ root Character Sets ใชในการก าหนดคาระบบภาษาทใชในการจดเกบฐานขอมล, เรยงล าดบฐานขอImport ฐานขอมล, Export ฐานขอมล, ตดตอฐานขอมล Old Password หากทานมปญหาเกยวกบการใชงาน PHP กบ MySQL API เวอรชนเกาโดยเจอ Error Client does not support authentication protocol requested by server; consider upgrading MySQL client ใหเลอกในสวนของ Old Password เพอหลกเลยงปญหาน Enable InnoDB หากทานตองการใชงานฐานขอมลในรปแบบ InnoDB ใหเลอกในสวนนดวย

Page 8: £µ ª - bc.msu.ac.th

116

ภาพท 6 แสดงการก าหนดคาคอนฟกของ MySQL Database 7. สนสดขนตอนการตดตงโปรแกรม AppServ ส าหรบขนตอนสดทายนจะมใหเลอกวาตองการสงใหมการรน Apache และ MySQLทนทหรอไม จากนนกดปม Finish เพอเสรจสนการตดตงโปรแกรม AppServ

Page 9: £µ ª - bc.msu.ac.th

117

ภาพท 7 แสดงหนาจอขนตอนสนสดการตดตงโปรแกรม AppServ

Page 10: £µ ª - bc.msu.ac.th

118

ผนวก ข

Source Code

Page 11: £µ ª - bc.msu.ac.th

119

Source Code ชอ Connect

<?

$host="localhost";

$user_name="root";

$pass_word="1234";

$db="pro";

$admin_email = "";

mysql_connect( $host,$user_name,$pass_word) or die (" ");

mysql_select_db($db) or die("");

?>

Source Code Index

?>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-874">

<title>::: รานฟอทแมนซอฟ :::</title>

<link href="css/styles.css" rel="stylesheet" type="text/css">

<style type="text/css">

<!--

body {

background-image: url();

}

.style1 {

font-size: 18

}

Page 12: £µ ª - bc.msu.ac.th

120

-->

</style></head>

<body topmargin="0">

<table width="778" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">

<tr>

<td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="0" cellspacing="0">

<tr>

<td>

<?php require_once('head.php'); ?>

</td>

</tr>

<tr>

<td><table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#f2f2f6"

bgcolor="#FFFFFF">

<tr>

<td width="23%" valign="top">

<?php require_once('menuleft.php'); ?>

</td>

<td width="54%" valign="top">

<table width="100%" border="0" cellpadding="0" cellspacing="0">

<!--DWLayoutTable-->

<tr>

<td width="417" height="24" valign="top"><div align="center">

<table width="100%" border="0" cellspacing="2" cellpadding="2">

<tr>

<td width="31%" height="15" valign="top"> <div align="left">

<p class="style1"><em><strong><br>

<br>

สวสดครบ<br>

Page 13: £µ ª - bc.msu.ac.th

121

<br>

รานฟอทแมนซอฟ</strong></em></p>

<p class="style1"><em><strong>ยนดตอนรบ</strong></em></p>

</div></td>

<td width="69%" valign="top"><img src="image/welcome.png" width="289"

height="236"></td>

</tr>

</table>

</div></td>

</tr>

<tr>

<td height="310" valign="top">

<table width="415" border="0">

<tr>

<td><hr width="96%" color="#f2f2f6"></td>

</tr>

<tr>

<td>

<table width="421" height="22" border="0" align="center" cellpadding="0"

cellspacing="0" id="Table_01">

<tr>

<td width="8"> <img src="image/menu01.jpg" width="8" height="22" alt=""></td>

<td width="389" background="image/menu02.jpg"><div align="center"><strong>

หมวดหมสนคา</strong>

</div></td>

<td width="9"> <img src="image/menu03.jpg" width="9" height="22" alt=""></td>

</tr>

</table></td>

</tr>

<tr>

<td>&nbsp; </td>

Page 14: £µ ª - bc.msu.ac.th

122

</tr>

<tr>

<td width="378">

<?

//============ อานขอมลหมวด

$sqlCat="select * from category where 1=1 order by CatID asc ";

$queryCat=mysql_query($sqlCat);

echo"<table><tr>";

$i=0;

while($resutCat=mysql_fetch_array($queryCat))

{

$i++;

echo "<td>";

?>

<table width="123" height="96" border="0" cellpadding="0" cellspacing="0">

<tr>

<td height="60" valign="top"><div align="center"><a

href="product.php?CatID=<?=$resutCat["CatID"];?>"><img src="picture/<?=$resutCat["Picture"];?>"

width="60" height="60" border="0" /></a></div></td>

</tr>

<tr>

<td valign="top"><div align="center"> <a

href="product.php?CatID=<?=$resutCat["CatID"];?>">

<?=$resutCat["CategoryName"];?>

<strong>

<?="(".num_record("product","where 1 and CatID='".$resutCat["CatID"]."' ").")";?>

</strong> </a></div></td>

</tr>

</table>

<?

//============ แสดงแถวละ 3 ตว

Page 15: £µ ª - bc.msu.ac.th

123

echo"</td>";

if(($i)%3==0)

{

echo"</tr>";

}

else

{

echo "<td>";

}

}

echo"</tr></table>";

?>

</td>

</tr>

</table>

<hr width="96%" color="#f2f2f6">

<br>

<table width="415" border="0">

<tr>

<td> <table width="421" height="22" border="0" align="center" cellpadding="0"

cellspacing="0" id="Table_01">

<tr>

<td width="8"> <img src="image/menu01.jpg" width="8" height="22" alt=""></td>

<td width="389" background="image/menu02.jpg"><div align="center"><strong>

สนคาใหม</strong>

</div></td>

<td width="9"> <img src="image/menu03.jpg" width="9" height="22" alt=""></td>

</tr>

</table></td>

</tr>

Page 16: £µ ª - bc.msu.ac.th

124

<tr>

<td width="378">

<?

//============ อานรายการสนคาลาสด

$sqlNewPro="select * from product where 1=1 and New='Yes' order by ProductID DESC limit 0,6 ";

$queryNewPro=mysql_query($sqlNewPro);

echo"<table align=center><tr>";

$i=0;

while($resutNewPro=mysql_fetch_array($queryNewPro))

{

$i++;

echo "<td>";

?>

<table width="121" height="105" border="0" cellpadding="3" cellspacing="10">

<tr>

<td height="60" valign="top"><div align="center"><a

href="detail.php?CatID=<?=$resutNewPro["CatID"];?>&ProductID=<?=$resutNewPro["ProductID"];?>"><img

src="picture/<?=$resutNewPro["Picture"];?>" width="140" height="105" border="0"></a></div></td>

</tr>

<tr>

<td valign="top"><div align="center"> <a

href="detail.php?CatID=<?=$resutNewPro["CatID"];?>&ProductID=<?=$resutNewPro["ProductID"];?>">

<?=$resutNewPro["ProductName"];?>

</a><br>

ปกต

<?="(<s>".number_format($resutNewPro["PriceNormal"], 2,'.',',')."</s>";?>

บาท) <br>

<font color="#FF0000"><strong>พเศษ</strong></font>

<?="(".number_format($resutNewPro["Price"], 2,'.',',');?>

บาท) <br>

คาจดสง

Page 17: £µ ª - bc.msu.ac.th

125

<?="(".number_format($resutNewPro["PriceSend"], 2,'.',',');?>

บาท) </div></td>

</tr>

</table>

<?

//============ แสดงแถวละ 2

echo"</td>";

if(($i)%2==0)

{

echo"</tr>";

}

else

{

echo "<td>";

}

}

echo"</tr></table>";

?>

</td>

</tr>

</table>

<hr width="96%" color="#f2f2f6">

</td>

</tr>

</table></td>

<td width="23%" valign="top">

<?php require_once('menuright.php'); ?>

</td>

</tr>

Page 18: £µ ª - bc.msu.ac.th

126

<tr>

<td colspan="3" valign="top">

<?php require_once('down.php'); ?>

</td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

</table>

</body>

</html>

Source Code หนา Cart

<?

ob_start();

//============ Start Session และท าการเรยก Function ตดตอฐานขอมล

session_start();

require("connect/connect.php");

require("connect/function.php");

?>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-874">

<title>::: รานฟอทแมนซอฟ :::</title>

<link href="css/styles.css" rel="stylesheet" type="text/css">

<style type="text/css">

<!--

body {

Page 19: £µ ª - bc.msu.ac.th

127

background-color: #ECE9D8;

background-image: url();

}

-->

</style></head>

<body topmargin="0">

<table width="778" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">

<tr>

<td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="0" cellspacing="0">

<tr>

<td>

<?php require_once('head.php'); ?>

<?

//============ Check วามซ าแลวหรอยง

if($_GET["ProductID"] != "")

{

for($i=0;$i<=count($_SESSION["strProductID"]);$i++)

{

if($_SESSION["strProductID"][$i] == $_GET["ProductID"])

{

header("location:$_SERVER[PHP_SELF]");

exit();

}

}

}

//============ ถามการเลอกรายการสนคาใหเกบลง Session

if(trim($_GET["ProductID"]) != "")

Page 20: £µ ª - bc.msu.ac.th

128

{

$_SESSION["strP"]=$_SESSION["strP"]+1;

$_SESSION["strProductID"][$_SESSION[strP]]=$_GET["ProductID"];

$_SESSION["strQuanlity"][$_SESSION[strP]]=1;

session_write_close();

header("location:$_SERVER[PHP_SELF]");

}

//============ กรณลบรายการสงซอ

if(trim($_GET["action"]) == "Del")

{

$_SESSION["strProductID"][$_GET[P]]="";

$_SESSION["strQuanlity"][$_GET[P]]="";

session_write_close();

header("location:$_SERVER[PHP_SELF]");

}

//============ กรณการแกไขรายการสงซอ

if(trim($_POST["action"]) == "Update")

{

for($i=0;$i<count($_POST["txtQua"]);$i++)

{

$strP=$_POST[txtP][$i];

$strQ=$_POST["txtQua"][$i];

if($strQ <= 0)

{

$strQ=1;

}

$_SESSION["strQuanlity"][$strP]=$strQ;

Page 21: £µ ª - bc.msu.ac.th

129

/*

$result=select("product","where 1=1 and ProductID='".$_SESSION["strProductID"][$strP]."'");

if($result["Stock"] < $strQ)

{

$_SESSION["strQuanlity"][$strP]=$result["Stock"];

echo"<script

language='JavaScript'>";

echo"alert('รหสสนคา [

$result[ProductCode] ] มจ านวน Stock ไมเพยงพอ');";

echo"</script>";

}

*/

}

session_write_close();

//============ กระโดด Refresh ใหมอกรอบ

header("location:$_SERVER[PHP_SELF]");

}

?>

</td>

</tr>

<tr>

<td><table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#f2f2f6"

bgcolor="#FFFFFF">

<tr>

<td width="23%" valign="top"> <?php require_once('menuleft.php'); ?> <br> </td>

<td width="54%" valign="top">

<table width="100%" border="0" cellpadding="0" cellspacing="0">

<!--DWLayoutTable-->

<tr>

<td width="417" height="310" valign="top">

Page 22: £µ ª - bc.msu.ac.th

130

<form action="" method="post" name="frmCart" id="frmCart">

<table width="415" border="0">

<tr>

<td><table width="418" height="22" border="0" align="center" cellpadding="0"

cellspacing="0" id="Table_01">

<tr>

<td width="8"> <img src="image/menu01.jpg" width="8" height="22" alt=""></td>

<td width="389" background="image/menu02.jpg"><div align="center"><strong>

รายการสงซอ

<input name="action" type="hidden" id="action" value="Update">

</strong></div></td>

<td width="9"> <img src="image/menu03.jpg" width="9" height="22" alt=""></td>

</tr>

</table>

<strong> </strong></td>

</tr>

<tr>

<td>&nbsp;</td>

</tr>

<tr>

<td><table width="98%" height="21" border="0" align="center" cellpadding="2"

cellspacing="1" bgcolor="#666666">

<tr bgcolor="#FFFFFF">

<td><div align="center">ล าดบ</div></td>

<td>ชอสนคา</td>

<td><div align="center">ราคา</div></td>

<td>คาจดสง</td>

<td><div align="center">จ านวน</div></td>

<td><div align="center">รวม</div></td>

</tr>

<?

Page 23: £µ ª - bc.msu.ac.th

131

//============ ท าการแสงรายการทไดเลอกวามกรายการ

$strNum=0;

$strTotal=0;

for($i=0;$i<=count($_SESSION["strProductID"]);$i++)

{

//============ เลอกวารายการสนคาใดบาง

$result=select("product","where 1=1 and ProductID='".$_SESSION["strProductID"]["$i"]."' ");

if($result)

{

$strNum++;

?>

<tr bgcolor="#FFFFFF">

<td width="9%"> <div align="center">

<?=$strNum;?>

<a href="javascript:if(confirm('ลบรายการ

สนคา')==true){window.location='<?=$_SERVER['PHP_SELF'];?>?action=Del&P=<?=$i;?>';}"><img

src="image/deleteC.gif" width="12" height="11" border="0"></a></div></td>

<td width="48%">

<?=$result["ProductName"];?>

</td>

<td width="14%"> <div align="right">

<?="".number_format($result["Price"], 2,'.',',');?>

</div></td>

<td width="13%">

<div align="right">

<?="".number_format($result["PriceSend"], 2,'.',',');?>

</div></td>

<td width="13%"><div align="center">

<input name="txtP[]" type="hidden" id="txtP[]" value="<?=$i;?>">

Page 24: £µ ª - bc.msu.ac.th

132

<input name="txtQua[]" type="text" id="txtQua<?=$strNum;?>"

style="width:30px;text-align:right" value="<?=$_SESSION["strQuanlity"]["$i"];?>" maxlength="3"

onChange="checknum(this.value,'txtQua<?=$strNum;?>');">

</div></td>

<td width="16%"> <div align="right">

<?="".number_format(($result["Price"]+$result["PriceSend"])*$_SESSION["strQuanlity"]["$i"], 2,'.',',');?>

</div></td>

</tr>

<?

$strTotal=$strTotal+(($result["Price"]+$result["PriceSend"])*$_SESSION["strQuanlity"]["$i"]);

}

}

?>

</table>

<br> <table width="98%" height="21" border="0" align="center" cellpadding="2"

cellspacing="1" bgcolor="#666666">

<tr bgcolor="#FFFFFF">

<td><div align="right">จ านวน (รายการ)</div></td>

<td> <div align="right">

<?=$strNum;?>

</div></td>

</tr>

<tr bgcolor="#FFFFFF">

<td> <div align="right">ราคารวม (บาท)</div></td>

<td width="16%"> <div align="right">

<?="".number_format($strTotal, 2,'.',',');?>

</div></td>

</tr>

</table></td>

</tr>

Page 25: £µ ª - bc.msu.ac.th

133

<tr>

<td width="378"><div align="center"><br>

<?

if($strNum==0)

{

echo "<br><center><strong><font color=red>

ไมมรายการสงซอ</font></strong></center><br><br>";

}

?>

<input name="BtnContinute" type="button" class="button" id="BtnContinute2"

value="ซอสนคาตอ" onClick="window.location='index.php';">

&nbsp;

<?

if($strNum>0)

{?>

<input name="BtnCalu" type="submit" class="button" id="BtnCalu" value="ค านวณเงน

ใหม">

&nbsp;

<input name="BtnPayment" type="button" class="button" id="BtnPayment"

value="ช าระเงน" onClick="window.location='pay.php';">

<?}?>

<br>

</div></td>

</tr>

</table>

<p class="style59">&nbsp;</p>

</form>

<p class="style59">&nbsp;

<script language="JavaScript">

function checknum(value,fields)

{

if(!check_number(value))

Page 26: £µ ª - bc.msu.ac.th

134

{

eval("document.all."+fields+".value='1';");

alert('กรอกจ านวนไมถกตอง');

}

}

function check_number(ch){

var len, digit;

if(ch == " "){

return false;

len=0;

}else{

len = ch.length;

}

for(var i=0 ; i<len ; i++)

{

digit = ch.charat(i)

if(digit >="0" && digit <="9"){

;

}else{

return false;

}

}

return true;

}

</script></p>

<p class="style59">&nbsp;</p>

<p class="style59">&nbsp;</p></td>

</tr>

Page 27: £µ ª - bc.msu.ac.th

135

</table></td>

<td width="23%" valign="top"> <?php require_once('menuright.php'); ?> </td>

</tr>

<tr>

<td colspan="3" valign="top">

<?php require_once('down.php'); ?>

</td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

</table>

</body>

</html>

Source Code Product

<?

ob_start();

//============ Start Session และท าการเรยก Function ตดตอฐานขอมล

session_start();

require("connect/connect.php");

require("connect/function.php");

?>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-874" >

<title>::: รานฟอทแมนซอฟ :::</title>

<link href="css/styles.css" rel="stylesheet" type="text/css">

</head>

Page 28: £µ ª - bc.msu.ac.th

136

<body topmargin="0">

<table width="778" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">

<tr>

<td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="0" cellspacing="0">

<tr>

<td>

<?php require_once('head.php'); ?>

</td>

</tr>

<tr>

<td><table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#f2f2f6"

bgcolor="#FFFFFF">

<tr>

<td width="23%" valign="top"> <?php require_once('menuleft.php'); ?> <br> </td>

<td width="54%" valign="top">

<table width="100%" border="0" cellpadding="0" cellspacing="0">

<!--DWLayoutTable-->

<tr>

<td width="417" height="310" valign="top">

<table width="415" border="0" align="center">

<tr>

<td><strong> </strong>

<table width="418" height="22" border="0" align="center" cellpadding="0"

cellspacing="0" id="Table_01">

<tr>

<td width="8"> <img src="image/menu01.jpg" width="8" height="22" alt=""></td>

<td width="389" background="image/menu02.jpg"><div align="center"><strong>

<?

//============ เลอกวาเปนหมวดอะไร

$resultHeadPro=select("category","where 1=1 and CatID='".$_GET["CatID"]."'");

if(!$resultHeadPro)

Page 29: £µ ª - bc.msu.ac.th

137

{

//header("location:index.php");

}

if($_GET["CatID"]!="")

{

echo "(".$resultHeadPro["CategoryName"].")";

}

else

{

echo "(แสดงทงหมด)";

}

?>

</strong> </div></td>

<td width="9"> <img src="image/menu03.jpg" width="9" height="22" alt=""></td>

</tr>

</table>

<strong> </strong></td>

</tr>

<tr>

<td>&nbsp;</td>

</tr>

<tr>

<td width="378">

<?

//============ เลอกรายการสนคาออกมาแสดง

$condition="";

if($_GET["CatID"] <> "")

{

$condition="and CatID='$_GET[CatID]' ";

Page 30: £µ ª - bc.msu.ac.th

138

}

echo"<table align=center><tr>";

$sql = "select * from product where 1=1 $condition ";

/* ตงคา แสดงผลตอหนา $Per_Page */

$Per_Page =8;

if(!$Page)

$Page=1;

//============ ค านวณจ านวนหนา

$Prev_Page = $Page-1;

$Next_Page = $Page+1;

$result=mysql_query($sql);

$Page_start = ($Per_Page*$Page)-$Per_Page;

$Num_Rows = mysql_num_rows($result);

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;

Page 31: £µ ª - bc.msu.ac.th

139

if(($Page>$Num_Pages) || ($Page<0))

print "<center><b>จ านวน $Page มากกวา $Num_Pages ยงไมมขอความ<b></center>";

$sql .= " order by ProductID DESC LIMIT $Page_start , $Per_Page";

//สวนแสดงผล

$i=0;

$query = mysql_query($sql);

While($resutNewPro= mysql_fetch_array($query)){

$i++;

echo "<td>";

?>

<table width="202" height="105" border="0" cellpadding="3" cellspacing="10">

<tr>

<td height="60" valign="top"><div align="center"><a

href="detail.php?CatID=<?=$resutNewPro["CatID"];?>&ProductID=<?=$resutNewPro["ProductID"];?>"><img

src="picture/<?=$resutNewPro["Picture"];?>" width="140" height="105" border="0"></a></div></td>

</tr>

<tr>

<td valign="top"><div align="center"> <a

href="detail.php?CatID=<?=$resutNewPro["CatID"];?>&ProductID=<?=$resutNewPro["ProductID"];?>">

<?=$resutNewPro["ProductName"];?>

</a><br>

ปกต

<?="(<s>".number_format($resutNewPro["PriceNormal"], 2,'.',',')."</s>";?>

บาท) <br>

<font color="#FF0000"><strong>พเศษ</strong></font>

<?="(".number_format($resutNewPro["Price"], 2,'.',',');?>

บาท)<br>

คาจดสง

<?="(".number_format($resutNewPro["PriceSend"], 2,'.',',');?>

บาท)</div></td>

Page 32: £µ ª - bc.msu.ac.th

140

</tr>

</table>

<?

//============ แสดงแถวละ สอง

echo"</td>";

if(($i)%2==0)

{

echo"</tr>";

}

else

{

echo "<td>";

}

}

echo"</tr></table>";

if($i==0)

{

echo "<strong><center><font color=red>ไมมรายการสนคา</font></center></strong>";

}

?>

<hr width="98%" color="#f2f2f6">

<table width="376" align="center" cellpadding="0" cellspacing="0">

<tr>

<td width="183" colspan="10" class="boxtext">จ านวน

<?=$Page;?>

หนา <b>

<?=$Num_Pages;?>

</b> (

Page 33: £µ ª - bc.msu.ac.th

141

<?= $Num_Rows;?>

รายการ) </td>

</tr>

</table>

<table width="98%" border="0" cellpadding="1" cellspacing="1">

<tr>

<td>

<?/* สรางปมยอนกลบ */

if($Prev_Page)

echo " <a

href='$PHP_SELF?Page=$Prev_Page&CatID=$_GET[CatID]' class='boxtext'><< Back </a> ";

for($i=1; $i<$Num_Pages; $i++){

if($i != $Page)

echo " [ <a

href='$PHP_SELF?Page=$i&CatID=$_GET[CatID]' class='boxtext'>$i</a> ]";

else

echo "<b> $i </b>";

}

/*สรางปมเดนหนา */

if($Page!=$Num_Pages)

echo " <a href

='$PHP_SELF?Page=$Next_Page&CatID=$_GET[CatID]' class='boxtext'> Next >> </a>";

?>

&nbsp;</td>

</tr>

</table></td>

</tr>

</table>

<p class="style59">&nbsp;</p>

<p class="style59">&nbsp;</p>

Page 34: £µ ª - bc.msu.ac.th

142

<p class="style59">&nbsp;</p></td>

</tr>

</table></td>

<td width="23%" valign="top"> <?php require_once('menuright.php'); ?> </td>

</tr>

<tr>

<td colspan="3" valign="top">

<?php require_once('down.php'); ?>

</td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

</table>

</body>

</html>

Page 35: £µ ª - bc.msu.ac.th

143

ผนวก ง

รายงานการเขาพบทปรกษา

Page 36: £µ ª - bc.msu.ac.th

รายงานการเขาพบทปรกษา

ชอเรอง ระบบ E-commerce รานฟอทแมนซอฟ กรงเทพมหานคร

ผศกษา นายทรงศกด ทองนช รหส50010918006

ทปรกษา อาจารยเกรยงศกด จนทนอก

วน เดอน ป รายงานความคบหนา/การใหค าปรกษา

ลายมอชอทปรกษา

16 ธนวาคม 2553 การจดท าตะกราสนคา

15 มกราคม 2554 เรอง sesion

29 มกราคม 2554 เรองการจายช าระเงน

18 กมพาพนธ 2554 การอฟขนsever คณะ