|
|
|
อยากทราบ วิธีการใส่ จุด ทศนิยมราคาสินค้าหลังจากกดซื้อนะครับ |
|
|
|
|
|
|
|
ตรงคอลัมม์ ราคา ผมจะให้ ราคาสินค้า ให้เเสดงทศนิยม 2ตำเเหน่ง เช่น 500.00 ต้องเพิ่มโค๊ดอะไรเข้าไปครับ ขอบคุณล่วงหน้าครับผม
Code
session_start(); //ต้องใส่ทุกครั้งที่มีการเรียกใช้งานตัวแปร session ต้องอยู่บรรทัดแรกเท่านั้น
//ประกาศตัวแปรที่ต้องการใช้งาน
session_register ("MemID");
session_register ("MemName");
session_register ("MemEmail");
session_register ("MemImg");
session_register ("Memstatus");
?>
<form action="check-admin.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<html>
<head>
<title>ร้าน ถ้วยรางวัล</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<style type="text/css">
<!--
body {
background-color: #FBFBFB;
background-image: url(bg1.jpg);
}
.style2 {
color: #0099FF;
font-weight: bold;
}
.style6 {font-size: 12px; font-weight: bold; color: #FF6600; }
.style7 {font-size: 12px; font-weight: bold; color: #0066FF; }
.style3 {
font-size: 24px
}
.style8 {
font-family: Georgia, "Times New Roman", Times, serif
}
.style9 {
color: #FF0000;
font-size: 24px;
}
.style10 {font-size: 36px}
.style11 {
font-family: Arial, Helvetica, sans-serif;
color: #0099FF;
font-weight: bold;
font-size: 18px;
}
-->
</style></head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('images/b5.jpg','images/b6.jpg','images/b7.jpg')">
<script language="JavaScript1.2">
var clickmessage="หากทีปัญหา หรือข้อสงสย กรุณาติดต่อ [email protected] ขอบคุณครับ"
function disableclick(e) {
if (document.all) {
if (event.button==2||event.button==3) {
if (event.srcElement.tagName=="IMG"){
alert(clickmessage);
return false;
}
}
}
else if (document.layers) {
if (e.which == 3) {
alert(clickmessage);
return false;
}
}
else if (document.getElementById){
if (e.which==3&&e.target.tagName=="IMG"){
alert(clickmessage)
return false
}
}
}
function associateimages(){
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}
if (document.all)
document.onmousedown=disableclick
else if (document.getElementById)
document.onmouseup=disableclick
else if (document.layers)
associateimages()
</script>
<div align="center">
<!-- ImageReady Slices (pro.psd) -->
<table id="Table_01" width="1135" height="1418" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3" rowspan="4">
<img src="images/index_01.jpg" width="704" height="40" alt=""></td>
<td colspan="2" rowspan="3">
<img src="images/index_02.jpg" width="35" height="39" alt=""></td>
<td colspan="10">
<img src="images/index_03.jpg" width="395" height="9" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="9" alt=""></td>
</tr>
<tr>
<td colspan="3" bgcolor="#2D2D2D"><input name="usernameA" type="text" id="usernameA" size="14" /></td>
<td>
<img src="images/index_05.jpg" width="52" height="27" alt=""></td>
<td colspan="2" bgcolor="#2D2D2D"><input name="passwordA" type="password" id="passwordA" size="14" /></td>
<td>
<img src="images/index_07.jpg" width="12" height="27" alt=""></td>
<td colspan="2" bgcolor="#2B2B2B"><input type="submit" name="button" id="button" value="Login" /></td>
<td>
<img src="images/index_09.jpg" width="42" height="27" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="27" alt=""></td>
</tr>
<tr>
<td colspan="10">
<img src="images/index_10.jpg" width="395" height="3" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="3" alt=""></td>
</tr>
<tr>
<td colspan="12" rowspan="2">
<img src="images/index_11.jpg" width="430" height="2" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td rowspan="6">
<img src="images/index_12.jpg" width="610" height="279" alt=""></td>
<td colspan="2">
<img src="images/index_13.jpg" width="94" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td colspan="14">
<img src="images/index_14.jpg" width="524" height="34" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="34" alt=""></td>
</tr>
<tr>
<td colspan="12">
<img src="images/index_15.jpg" width="478" height="1" alt=""></td>
<td colspan="2" rowspan="2">
<img src="images/index_16.jpg" width="46" height="57" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="images/index_17.jpg" width="116" height="56" alt=""></td>
<td colspan="3"><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image52','','images/b5.jpg',1)"><img src="images/b2.jpg" name="Image52" width="129" height="56" border="0"></a></td>
<td colspan="3"><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image53','','images/b6.jpg',1)"><img src="images/b3.jpg" name="Image53" width="129" height="56" border="0"></a></td>
<td colspan="3"><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image54','','images/b7.jpg',1)"><img src="images/b4.jpg" name="Image54" width="104" height="56" border="0" usemap="#Image54Map"></a></td>
<td>
<img src="images/spacer.gif" width="1" height="56" alt=""></td>
</tr>
<tr>
<td>
<img src="images/index_21.jpg" width="2" height="50" alt=""></td>
<td colspan="13">
<img src="images/index_22.jpg" width="522" height="50" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="50" alt=""></td>
</tr>
<tr>
<td colspan="14">
<img src="images/index_23.jpg" width="524" height="137" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="137" alt=""></td>
</tr>
<tr>
<td colspan="15">
<img src="images/index_24.jpg" width="1134" height="69" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="69" alt=""></td>
</tr>
<tr>
<td colspan="6" rowspan="2" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0">
<tr>
<td><? include("news_index.php"); ?></td>
</tr>
</table> <table width="100%" border="0">
<tr>
<td width="100%" align="left"><h1 align="center" class="style2 style3 style8"><span class="style10"><br>
<br>
สินค้ามาใหมล่าสัส</span><span class="style9">! ! !</span></h1>
<table border="0" cellpadding="0" cellspacing="0" align="center" width="99%">
<?
include("connect_db.php");
$sql="select*from product order by proID DESC limit 6";
$result=mysql_db_query($dbname,$sql);
$i=0;
while($arr=mysql_fetch_array($result)){
if($i%3==0){echo "</TR><TR align=center valign=top>";}
?>
<TD width=33% style="color: #000000"><table border="0">
<tr>
<td colspan="2"><div align="left" class="style6"><a id="example" href="productImg/<?echo $arr[proImg];?>" title="<? echo $arr[proName]; ?> : <? echo $arr[proDesc]; ?>."><img src="productImg/<?echo $arr[proImg];?>" alt="Prduct" width="150" height="150" style=" border: 1px solid #BBB; padding: 2px; margin: 2px 2px 2px 0; vertical-align: top;" /></a></div></td>
</tr>
<tr>
<td><div align="left" class="style7">ชื่อสินค้า : </div></td>
<td><div align="left" class="style6"><? echo $arr[proName]; ?></div></td>
</tr>
<tr>
<td><div align="left" class="style7">รายละเอียด :</div></td>
<td><div align="left" class="style6"><? echo $arr[proDesc]; ?></div></td>
</tr>
<tr>
<td><div align="left" class="style7">ราคา :</div></td>
<td><div align="left" class="style6"><? echo $arr[proSale]; ?></div></td>
</tr>
<tr>
<td colspan="2" align="center"><a href="basket.php?proID=<?echo $arr[proID];?>"><img src="add.jpg" width="64" height="19" /></a></td>
</tr>
</table> <p> </p></TD>
<?
$i++;
} ?>
</table>
<p class="style2 style3"> </p>
<p class="style2"> </p>
<p class="style2"> </p></td>
</tr>
</table></td>
<td colspan="9" valign="top" bgcolor="#FFFFFF"><table width="100" border="0" align="center">
<tr>
<td><embed src=http://i245.photobucket.com/albums/gg78/looma001/aloomaclock2.swf quality="high" width="180" height="180" wmode="transparent"></embed></td>
</tr>
</table></td>
<td>
<img src="images/spacer.gif" width="1" height="286" alt=""></td>
</tr>
<tr>
<td colspan="9" align="left" valign="top" bgcolor="#FFFFFF">
<p align="center" class="style11">หมวดหมูสินค้า</p>
<table width="80%" border="0" align="right" cellpadding="0" cellspacing="0" >
<?
include("connect_db.php");
$sql="select*from product_group order by pName";
$result=mysql_db_query($dbname,$sql);
$i=1;
while($arr=mysql_fetch_array($result)){
?>
<TR align=center>
<TD align=left width=5%>
<a id="example5" href="productImg/<?echo $arr[pImg];?>" title="ชื่อประเภทสินค้า : <? echo $arr[pName]; ?>">
<img src="productImg/<?echo $arr[pImg];?>" alt="No Picture" width="50" height=50 style=" border: 1px solid #BBB; padding: 2px; margin: 2px 2px 2px 0; vertical-align: top;" /></a> </TD>
<TD align=left style="font-family:Geneva, Arial, Helvetica, sans-serif;font-size:13px"><a href="product_index2.php?id=<? echo "$arr[pID]";?>"><? echo $arr[pName]; ?></a></TD>
</TR>
<?
$i++;
} ?>
</table></td>
<td>
<img src="images/spacer.gif" width="1" height="624" alt=""></td>
</tr>
<tr>
<td colspan="15">
<img src="images/index_29.jpg" width="1134" height="119" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="119" alt=""></td>
</tr>
<tr>
<td>
<img src="images/spacer.gif" width="610" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="2" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="92" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="22" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="13" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="5" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="111" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="4" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="52" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="73" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="46" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="12" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="46" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="4" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="42" height="1" alt=""></td>
<td>
</FORM> </td>
<embed style="left: 0px; width: 1900px; position: absolute; top: 0px; height: 350px;" src="http://imgfree.21cn.com/free/flash/6.swf" type="application/octet-stream" wmode="transparent" quality="high" align="3" height="2500" width="1"></embed>
</tr>
</table>
<!-- End ImageReady Slices -->
</div>
<map name="Image54Map"><area shape="rect" coords="4,2,98,50" href="coment.php" target="_parent">
</map></body>
</html>[/ftp]
Tag : PHP, MySQL, HTML/CSS, CakePHP
|
ประวัติการแก้ไข 2012-01-10 21:03:58
|
|
|
|
|
Date :
2012-01-10 21:00:27 |
By :
gbgetbackers |
View :
1159 |
Reply :
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
echo number_format(500,2);
|
|
|
|
|
Date :
2012-01-10 21:05:55 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณมากครับ รบกวนถามอีกนิดนึงนะครับว่า เอาไปใส่ตรงไหนหรอครับ ขอบคุณมากๆนะครับ
|
|
|
|
|
Date :
2012-01-10 21:12:43 |
By :
gbgetbackers |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
คุณอยากให้มันแสดงตรงไหนก็ใส่ตรงนั้นแหละครับ
Code (PHP)
$var = 500;
echo number_format($var,2);
|
|
|
|
|
Date :
2012-01-10 21:15:31 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|