Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,028

HOME > PHP > PHP Forum > มาช่วยจับผิดให้หน่อยนะค่ะ ข้อมูลมันแสดงได้อย่างไร งงค่ะ



 

มาช่วยจับผิดให้หน่อยนะค่ะ ข้อมูลมันแสดงได้อย่างไร งงค่ะ

 



Topic : 090892



โพสกระทู้ ( 32 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook



เรื่องมีอยู่ว่า "ยังไม่ใส่ข้อมูลการค้นหาแล้วข้อมูลมันแสดงได้อย่างไร "

ภาพหน้าฟอร์ม Form_sell.php
show

<?php
$sql="select * from product ";
$sql.="where pro_name1 LIKE '%$product_search%' OR pro_id LIKE '%$product_search%' ";
$dbquery=mysql_query($sql)or die (mysql_error());
$resultSearch=mysql_fetch_array($dbquery);
?>
</p>
<p></p>

<form id="form4" name="form4" method="post" action="Form_Sell.php">
<table width="600" border="0" align="center">
<tr>
<td width="100">ชื่อการค้า :</td>
<td width="200"><input name="pro_name1" type="text" id="pro_name1"
value="<?=$resultSearch["pro_name1"];?>" /> </td>
<td width="100">ชื่อสามัญ :</td>
<td width="200"><input name="pro_name" type="text" id="pro_name"
value="<?=$resultSearch["pro_name"];?>" size="20" readonly="readonly" /></td>
</tr>
<tr>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
</tr>
<tr>
<td width="100">จำนวน :</td>
<td width="200"><input name="sale_qty" type="text" id="sale_qty" value="<?=$sale_qty?>" size="20" /></td>
<td width="100">หน่วยนับ :</td>
<td width="200"><input name="unit" type="text" id="unit" value="<?=$resultSearch["unit"];?>" size="20" readonly="readonly" /></td>
</tr>
<tr>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
</tr>
<tr>
<td width="100">ราคา :</td>
<td width="200"><input name="price" type="text" id="price" value="<?=$resultSearch["price"];?>" size="20" readonly="readonly" /></td>
<td width="100">&nbsp;</td>
<td width="200">
<input name="proId" type="hidden" id="proId" value="<?=$resultSearch["pro_id"] ?>" />
<input name="act2" type="hidden" id="act2" value="add" />
<input name="add" type="submit" id="add" value="เพิ่มรายการ" /></td>
</tr>




Tag : PHP, MySQL









ประวัติการแก้ไข
2013-02-14 23:43:04
2013-02-14 23:48:18
Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2013-02-14 23:31:22 By : sunaree View : 849 Reply : 13
 

 

No. 1



โพสกระทู้ ( 3,155 )
บทความ ( 0 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์


Code (PHP)
$sql="select * from product ";
$sql.="where pro_name1 LIKE '%$product_search%' OR pro_id LIKE '%$product_search%' ";


ถ้า $product_search ไม่มีค่า มันก็จะส่งผลให้เป็นแบบนี้ครับ

Code
select * from product where pro_name1 LIKE '%%' OR pro_id LIKE '%%' ";


ลองเอาคำสั่งนี้ไปรันทดสอบดูซิครับ จะเห็นผลลลัพธ์ออกมามากมาย






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-02-14 23:35:05 By : sakuraei
 


 

No. 2



โพสกระทู้ ( 32 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

เป็นหนักเลยค่ะ พอใส่ข้อมูล แล้ว กดค้นหา ไม่มีข้อมูลมาแสดงเลยค่ะ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-02-14 23:47:18 By : sunaree
 

 

No. 3



โพสกระทู้ ( 3,155 )
บทความ ( 0 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์


โค้ดของฟอร์มรับข้อมูลเพื่อค้นหาอยู่ไหนครับ อยู่ในไฟล์เดียวกันกับส่วนแสดงผลค้นหาหรือเปล่า
เอามาดูหน่อยครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-02-14 23:52:05 By : sakuraei
 


 

No. 4



โพสกระทู้ ( 342 )
บทความ ( 2 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์


ลองเทสดูก่อนงับ
<?php 
$sql="select * from product ";
$sql.="where pro_name1 LIKE '%$product_search%' OR pro_id LIKE '%$product_search%' ";
$dbquery=mysql_query($sql)or die (mysql_error());
$resultSearch=mysql_fetch_array($dbquery);
?>
<?
if($resultSearch!=""){
?>
<form id="form4" name="form4" method="post" action="Form_Sell.php">
<table width="600" border="0" align="center">
<tr>
<td width="100">ชื่อการค้า :</td>
<td width="200"><input name="pro_name1" type="text" id="pro_name1" 
value="<?=$resultSearch["pro_name1"];?>" /> </td>
<td width="100">ชื่อสามัญ :</td>
<td width="200"><input name="pro_name" type="text" id="pro_name" 
value="<?=$resultSearch["pro_name"];?>" size="20" readonly="readonly" /></td>
</tr>
<tr>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
</tr>
<tr>
<td width="100">จำนวน :</td>
<td width="200"><input name="sale_qty" type="text" id="sale_qty" value="<?=$sale_qty?>" size="20" /></td>
<td width="100">หน่วยนับ :</td>
<td width="200"><input name="unit" type="text" id="unit" value="<?=$resultSearch["unit"];?>" size="20" readonly="readonly" /></td>
</tr>
<tr>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
</tr>
<tr>
<td width="100">ราคา :</td>
<td width="200"><input name="price" type="text" id="price" value="<?=$resultSearch["price"];?>" size="20" readonly="readonly" /></td>
<td width="100">&nbsp;</td>
<td width="200">
<input name="proId" type="hidden" id="proId" value="<?=$resultSearch["pro_id"] ?>" />
<input name="act2" type="hidden" id="act2" value="add" />
<input name="add" type="submit" id="add" value="เพิ่มรายการ" /></td>
</tr>
<?
}
?>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-02-15 00:00:42 By : weaned
 


 

No. 5



โพสกระทู้ ( 32 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

ตอบความคิดเห็นที่ : 4 เขียนโดย : weaned เมื่อวันที่ 2013-02-15 00:00:42
รายละเอียดของการตอบ ::
ขอบคุณมากค่ะ แต่ยังไม่ได้กดค้นหาข้อมูลก็ยังแสดงอยู่อ่ะค่ะ



ประวัติการแก้ไข
2013-02-15 00:32:18
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-02-15 00:14:21 By : sunaree
 


 

No. 6



โพสกระทู้ ( 32 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

ตอบความคิดเห็นที่ : 3 เขียนโดย : sakuraei เมื่อวันที่ 2013-02-14 23:52:05
รายละเอียดของการตอบ ::
โค้ดทั้งหมดค่ะ
Code
<body background="Image/bg_ad.jpg">
<? include("connect.php");?>
<table width="1024" border="0" align="center">
<tr>
<td align="center"><img src="image/Lo.jpg" alt="" width="667" height="213" /></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><fieldset>
<legend align="center" style="color:#99cc00"><font face="MS Serif, New York, serif" size="+2">ขายสินค้า</font></legend>
<table width="866" border="0" align="center">
<tr>
<td colspan="3" align="center">&nbsp;</td>
</tr>
<tr>
<td align="center"><a href="index_admin.php">
<img src="image/house.jpg" alt="" width="80" height="60" border="0" /></a></td>
<td width="538" rowspan="3" align="center"></td>
<td width="186" align="center"><a href="Logout.php">
<img src="image/crm/cancle-icon.png" width="60" height="60" border="0" /></a></td>
</tr>
<tr>
<td width="128" align="center"><p>กลับสู่หน้าหลัก</p></td>
<td align="center">ออกระบบ</td>
</tr>
<tr>
<td align="left">&nbsp;</td>
<td align="center">&nbsp;</td>
</tr>
<tr>
<td colspan="3" align="center">&nbsp;</td>
</tr>
<tr>
<td colspan="3" ><fieldset>
<legend style="color:#09F">ข้อมูลการขาย</legend>
<table width="800" border="0" align="center">
<tr align="right">
<td width="774">
<p>&nbsp;</p>
<form id="form1" name="form1" method="get" action="Form_Sell.php">
<table width="558" height="46" border="0" align="center">
<tr bgcolor="#CCFF99">
<td width="210"><center>รหัสสินค้า :</center></td>
<td width="179" align="center">
<input name="product_search" type="text" id="product_search" value="<?=$_GET[product_search];?>" />
</td>
<td width="155" align="center">
<input type="submit" name="button_product_search" id="button_product_search" value="ค้นหา"/>
</td>
</tr>
</table>
</form>

<p>
<?php
//$product_search=$_GET[product_search];
$sql="select * from product where pro_id Like '%$product_search%'or pro_name1 Like '%$product_search%'";
$dbquery=mysql_query($sql)or die (mysql_error());
$resultSearch=mysql_fetch_array($dbquery);
?>
</p>
<p></p>
<?
if($resultSearch!=""){
?>
<form id="form4" name="form4" method="post" action="Form_Sell.php">
<table width="600" border="0" align="center">
<tr>
<td width="100">ชื่อการค้า :</td>
<td width="200"><input name="pro_name1" type="text" id="pro_name1"
value="<?=$resultSearch["pro_name1"];?>" /> </td>
<td width="100">ชื่อสามัญ :</td>
<td width="200"><input name="pro_name" type="text" id="pro_name"
value="<?=$resultSearch["pro_name"];?>" size="20" readonly="readonly" /></td>
</tr>
<tr>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
</tr>
<tr>
<td width="100">จำนวน :</td>
<td width="200"><input name="sale_qty" type="text" id="sale_qty" value="<?=$sale_qty?>" size="20" /></td>
<td width="100">หน่วยนับ :</td>
<td width="200"><input name="unit" type="text" id="unit" value="<?=$resultSearch["unit"];?>" size="20" readonly="readonly" /></td>
</tr>
<tr>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
</tr>
<tr>
<td width="100">ราคา :</td>
<td width="200"><input name="price" type="text" id="price" value="<?=$resultSearch["price"];?>" size="20" readonly="readonly" /></td>
<td width="100">&nbsp;</td>
<td width="200">
<input name="proId" type="hidden" id="proId" value="<?=$resultSearch["pro_id"] ?>" />
<input name="act2" type="hidden" id="act2" value="add" />
<input name="add" type="submit" id="add" value="เพิ่มรายการ" /></td>
</tr>
<? }?>
<tr>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
</tr>
</table>
</p>
</form></td>
</tr>


<form id="form2" name="form2" method="POST" action="Form_Sell.php">
</form>
</table>
<p>&nbsp;</p>
<?php
include("connect.php");
$new_id =mysql_result(mysql_query("Select Max(substr(id_bill,- 7))+1 as MaxID from bill"),0,"MaxID");
//เลือกเอาค่า id ที่มากที่สุดในฐานข้อมูลและบวก 1 เข้าไปด้วยเลย
if($new_id==''){ // ถ้าได้เป็นค่าว่าง หรือ null ก็แสดงว่ายังไม่มีข้อมูลในฐานข้อมูล
$id_bill="RE0000001";
}else{
$id_bill="RE".sprintf("%07d",$new_id);//ถ้าไม่ใช่ค่าว่าง
}
?>
<table width="803" height="41" border="0" align="center">
<tr bgcolor="#FFFF99">
<td width="388">เลขที่ใบเสร็จ :
<label>
<?=$id_bill?>
</label></td>
<td width="198">วันที่ :
<label>
<?
$d=date("j");
$thai_m=array("มกราคม","กุมพาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม");
$m=$thai_m[date("n")-1];
$y=date("Y")+543; echo "$d $m $y" ?>
</label></td>
<td width="203">เวลา :
<label> <? echo date("H:i:s");?></label></td>
</tr>
</table>
<table width="800" border="0" align="center">
<tr align="center">
<td><legend align="left" style="color:#09F">รายการสินค้า : </legend></td>
<td width="300">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr align="center" bgcolor="#66CCFF">
<td width="100"><font color="#FFFFFF">รหัสสินค้า</font></td>
<td width="300"><font color="#FFFFFF">ชื่อการค้า</font></td>
<td width="100"><font color="#FFFFFF">จำนวน</font></td>
<td width="100"><font color="#FFFFFF">ราคา/หน่วย</font></td>
<td width="100"><font color="#FFFFFF">จำนวนเงิน</font></td>
<td width="100"><font color="#FFFFFF">ลบรายการ</font></td>
</tr>
<?

if($_POST[act]==add){
$sqlPro="select * from product where pro_id = '$_POST[proId]'";
$rePro=mysql_query($sqlPro);
$resultPro=mysql_fetch_array($rePro);

$sqlAddPro="insert into sell_detail_temp (pro_id,pro_name,sale_qty,amount,cus_id) values('$resultPro[pro_id]','$resultPro[pro_name]','$_POST[sale_qty]','$resultPro[price]','$sess_cusid')";
$ok=mysql_query($sqlAddPro) ;
$_POST[act] = wait;
}
else if($_POST[act]==del){
$sqlDel="DELETE FROM sell_detail_temp WHERE id_saleDetail = '$_POST[deleteId]' and cus_id='$sess_cusid'";
$ok=mysql_query($sqlDel);
$_POST[act] = wait;
}

if($_POST[act]== wait){
?>
<script language="javascript">
window.location="Form_Sell.php";
</script>
<? }

?>
<form id="formSell" name="formSell" method="post" action="Form_Sell.php">
<?
$sql="select * from sell_detail_temp where cus_id='$sess_cusid'";
$dbquery=mysql_query($sql);
//if($dbquery) {


while($row=mysql_fetch_array($dbquery)){

echo("<tr align=\"center\" bgcolor=\"#CCFFFF\">");
echo("<td>".$row["pro_id"]."</td>");
echo("<td>".$row["pro_name"]."</td>");
echo("<td>".$row["sale_qty"]."</td>");
echo("<td>".$row["amount"]."</td>");
echo("<td>".$row["sale_qty"]*$row["amount"]."</td>");
echo("<input type=\"hidden\" name=\"deleteId\" id=\"deleteId\" value=\"".$row["id_saleDetail"]."\" />");
echo("<input type=\"hidden\" name=\"act\" id=\"act\" value=\"del\" />");
echo("<td><input type=\"submit\" name=\"delete\" id=\"submit\" value=\"ลบ\" /></td>");
echo("</tr>");

$qPrice = $row["sale_qty"]*$row["amount"];
$totalPrice += $qPrice;

}
//}
?>
</form>
<tr align="center" bgcolor="#FFFFFF">
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<p>&nbsp;</p>
</fieldset>
<?php

if($_POST[act] == nCal){
$cash=$_POST[cash];
$change = $cash - $totalPrice;
}
?>
<form id="form3" name="form3" method="post" >
<table width="450" border="0" align="right" cellpadding="3">
<tr>
<td width="150" rowspan="3" align="right"><img src="image/buy/calculator2-icon.png" alt="" width="60" height="54" align="absmiddle" /></td>
<td width="150" align="right"><font size="+1" color="#0000FF">ยอดรวมสุทธิ :</font></td>
<td width="100" align="left">
<input name="total" type="text" id="total" value="<?=$totalPrice?>" size="10" readonly="readonly" /></td>
<td width="50"></td>
</tr>
<tr>
<td width="150" align="right"><font size="+1" color="#0000FF">รับเงินมา :</font></td>
<td width="100" align="left"><input name="cash" type="text" id="cash" size="10" value="<?=$cash?>" /></td>
<input type="hidden" name="act" id="act" value="nCal"/>
<td width="50" align="center"><input type="submit" name="button1" value="..." /></td>
</tr>
<tr>
<td width="150" align="right"><font size="+1" color="#0000FF">เงินทอน :</font></td>
<td width="100" align="left">
<input name="change" type="text" disabled="disabled" id="change" size="10" value="<?=$change?>" /></td>
<td width="50"></td>
</tr>
</table>
</form>
</table>
</fieldset>

<tr>
<td colspan="3" align="right">&nbsp;</td>
</tr>
<tr>
<td colspan="3" align="right"><table width="400" border="0" align="center">
<tr align="center">
<td width="200"><a href="send_save_sell_order_shop.php?total=<?=$totalPrice?>"> <img src="image/buy/save-icon.png" alt="" width="60" height="60" border="0" /></a></td>
</tr>
<tr align="center">
<td width="200"><font color="#CC0000">บันทึกการขาย</font></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<? mysql_close();?>


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-02-15 00:17:05 By : sunaree
 


 

No. 7



โพสกระทู้ ( 32 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

ตอบความคิดเห็นที่ : 6 เขียนโดย : sunaree เมื่อวันที่ 2013-02-15 00:17:05
รายละเอียดของการตอบ ::
show2

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-02-15 00:31:27 By : sunaree
 


 

No. 8



โพสกระทู้ ( 342 )
บทความ ( 2 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์


ส่วนค้นหานะ ไม่แน่ใจ ลองดูนะ
<form id="form1" name="form1" method="get" action="<?=$_SERVER['SCRIPT_NAME'];?>">
<table width="558" height="46" border="0" align="center">
<tr bgcolor="#CCFF99">
<td width="210"><center>รหัสสินค้า :</center></td>
<td width="179" align="center">
<input name="product_search" type="text" id="product_search" value="<?=$_GET["product_search"];?>" />
</td>
<td width="155" align="center">
<input type="submit" name="button_product_search" id="button_product_search" value="ค้นหา"/>
</td>
</tr>
</table>
</form>

<?php 
$sql="select * from product where (proid LIKE '%".$_GET["product_search"]."%')";
$dbquery=mysql_query($sql)or die (mysql_error());
$resultSearch=mysql_fetch_array($dbquery);

if($_GET["product_search"] != ""){
?>
<form id="form4" name="form4" method="post" action="Form_Sell.php">
<table width="600" border="0" align="center">
<tr>
<td width="100">ชื่อการค้า :</td>
<td width="200"><input name="pro_name1" type="text" id="pro_name1" 
value="<?=$resultSearch["pro_name1"];?>" /> </td>
<td width="100">ชื่อสามัญ :</td>
<td width="200"><input name="pro_name" type="text" id="pro_name" 
value="<?=$resultSearch["pro_name"];?>" size="20" readonly="readonly" /></td>
</tr>
<tr>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
</tr>
<tr>
<td width="100">จำนวน :</td>
<td width="200"><input name="sale_qty" type="text" id="sale_qty" value="<?=$resultSearch["sale_qty"];?>" size="20" /></td>
<td width="100">หน่วยนับ :</td>
<td width="200"><input name="unit" type="text" id="unit" value="<?=$resultSearch["unit"];?>" size="20" readonly="readonly" /></td>
</tr>
<tr>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
</tr>
<tr>
<td width="100">ราคา :</td>
<td width="200"><input name="price" type="text" id="price" value="<?=$resultSearch["price"];?>" size="20" readonly="readonly" /></td>
<td width="100">&nbsp;</td>
<td width="200">
<input name="proId" type="hidden" id="proId" value="<?=$resultSearch["pro_id"] ?>" />
<input name="act2" type="hidden" id="act2" value="add" />
<input name="add" type="submit" id="add" value="เพิ่มรายการ" /></td>
</tr>
<? }?>
<tr>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
</tr>
</table>
</p>
</form></td>
</tr>



ประวัติการแก้ไข
2013-02-15 00:44:29
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-02-15 00:41:17 By : weaned
 


 

No. 9



โพสกระทู้ ( 1,819 )
บทความ ( 20 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Facebook

คือมันก็ต้องแสดงสิครับ ในเมื่อคุณค้นหามันตลอด ถึงแม้คุณจะไม่ได้กรอกข้อมูลการค้นหาก็ตาม

ตรงนี้อ่ะครับ

<?php
//$product_search=$_GET[product_search];
$sql="select * from product where pro_id Like '%$product_search%'or pro_name1 Like '%$product_search%'";
$dbquery=mysql_query($sql)or die (mysql_error());
$resultSearch=mysql_fetch_array($dbquery);
?>
</p>
<p></p>
<?
if($resultSearch!=""){
?>


เพราะเมื่อคุณยังไม่ได้พิมพ์คีย์เวิร์ด คิวรี่ที่ได้ก็จะเป็น

Code (SQL)
select * from product where pro_id Like '%%'or pro_name1 Like '%%'


ซึ่งจะให้ผลเหมือนกับคุณ SELECT ทุกแถวออกมาหมดเลย

ดังนั้นคุณต้องตรวจสอบก่อนว่า มีข้อมูลการค้นหามั้ย ถ้ามี ค่อยเพิ่มเงื่อนไขการค้นหาเข้าไป
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-02-15 00:44:17 By : cookiephp
 


 

No. 10



โพสกระทู้ ( 1,819 )
บทความ ( 20 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Facebook

Code (PHP)
<?php 
//$product_search=$_GET[product_search];

if (!empty($product_search)) {
   $sql="select * from product where pro_id Like '%$product_search%'or pro_name1 Like '%$product_search%'";
   $dbquery=mysql_query($sql)or die (mysql_error());
   $resultSearch=mysql_fetch_array($dbquery);
} else {
   $resultSearch = false;
}
?>
</p>
<p></p>
<? 
if($resultSearch!=""){
?>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-02-15 00:46:50 By : cookiephp
 


 

No. 11



โพสกระทู้ ( 342 )
บทความ ( 2 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์



<body background="Image/bg_ad.jpg">
<? include("connect.php");?>
<table width="1024" border="0" align="center">
<tr>
<td align="center"><img src="image/Lo.jpg" alt="" width="667" height="213" /></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><fieldset>
<legend align="center" style="color:#99cc00"><font face="MS Serif, New York, serif" size="+2">ขายสินค้า</font></legend>
<table width="866" border="0" align="center">
<tr>
<td colspan="3" align="center">&nbsp;</td>
</tr>
<tr>
<td align="center"><a href="index_admin.php">
<img src="image/house.jpg" alt="" width="80" height="60" border="0" /></a></td>
<td width="538" rowspan="3" align="center"></td>
<td width="186" align="center"><a href="Logout.php"> 
<img src="image/crm/cancle-icon.png" width="60" height="60" border="0" /></a></td>
</tr>
<tr>
<td width="128" align="center"><p>กลับสู่หน้าหลัก</p></td>
<td align="center">ออกระบบ</td>
</tr>
<tr>
<td align="left">&nbsp;</td>
<td align="center">&nbsp;</td>
</tr>
<tr>
<td colspan="3" align="center">&nbsp;</td>
</tr>
<tr>
<td colspan="3" ><fieldset>
<legend style="color:#09F">ข้อมูลการขาย</legend>
<table width="800" border="0" align="center">
<tr align="right">
<td width="774">
<p>&nbsp;</p>
<form id="form1" name="form1" method="get" action="<?=$_SERVER['SCRIPT_NAME'];?>">
<table width="558" height="46" border="0" align="center">
<tr bgcolor="#CCFF99">
<td width="210"><center>รหัสสินค้า :</center></td>
<td width="179" align="center">
<input name="product_search" type="text" id="product_search" value="<?=$_GET["product_search"];?>" />
</td>
<td width="155" align="center">
<input type="submit" name="button_product_search" id="button_product_search" value="ค้นหา"/>
</td>
</tr>
</table>
</form>

<?php 
if($_GET["product_search"] != ""){
$sql="select * from product where (proid LIKE '%".$_GET["product_search"]."%' or pro_name1 LIKE '%".$_GET["product_search"]."%')";
$dbquery=mysql_query($sql)or die (mysql_error());
$resultSearch=mysql_fetch_array($dbquery);
?>
<form id="form4" name="form4" method="post" action="Form_Sell.php">
<table width="600" border="0" align="center">
<tr>
<td width="100">ชื่อการค้า :</td>
<td width="200"><input name="pro_name1" type="text" id="pro_name1" 
value="<?=$resultSearch["pro_name1"];?>" /> </td>
<td width="100">ชื่อสามัญ :</td>
<td width="200"><input name="pro_name" type="text" id="pro_name" 
value="<?=$resultSearch["pro_name"];?>" size="20" readonly="readonly" /></td>
</tr>
<tr>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
</tr>
<tr>
<td width="100">จำนวน :</td>
<td width="200"><input name="sale_qty" type="text" id="sale_qty" value="<?=$resultSearch["sale_qty"];?>" size="20" /></td>
<td width="100">หน่วยนับ :</td>
<td width="200"><input name="unit" type="text" id="unit" value="<?=$resultSearch["unit"];?>" size="20" readonly="readonly" /></td>
</tr>
<tr>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
</tr>
<tr>
<td width="100">ราคา :</td>
<td width="200"><input name="price" type="text" id="price" value="<?=$resultSearch["price"];?>" size="20" readonly="readonly" /></td>
<td width="100">&nbsp;</td>
<td width="200">
<input name="proId" type="hidden" id="proId" value="<?=$resultSearch["pro_id"] ?>" />
<input name="act2" type="hidden" id="act2" value="add" />
<input name="add" type="submit" id="add" value="เพิ่มรายการ" /></td>
</tr>
<? }?>
<tr>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
<td width="100">&nbsp;</td>
<td width="200">&nbsp;</td>
</tr>
</table>
</p>
</form></td>
</tr>


<form id="form2" name="form2" method="POST" action="Form_Sell.php">
</form>
</table>
<p>&nbsp;</p>
<?php
include("connect.php");
$new_id =mysql_result(mysql_query("Select Max(substr(id_bill,- 7))+1 as MaxID from bill"),0,"MaxID");
//เลือกเอาค่า id ที่มากที่สุดในฐานข้อมูลและบวก 1 เข้าไปด้วยเลย
if($new_id==''){ // ถ้าได้เป็นค่าว่าง หรือ null ก็แสดงว่ายังไม่มีข้อมูลในฐานข้อมูล

$id_bill="RE0000001";
}else{
$id_bill="RE".sprintf("%07d",$new_id);//ถ้าไม่ใช่ค่าว่าง
}
?>
<table width="803" height="41" border="0" align="center">
<tr bgcolor="#FFFF99">
<td width="388">เลขที่ใบเสร็จ :
<label>
<?=$id_bill?>
</label></td>
<td width="198">วันที่ :
<label>
<? 
$d=date("j");
$thai_m=array("มกราคม","กุมพาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม");
$m=$thai_m[date("n")-1];
$y=date("Y")+543; echo "$d $m $y" ?>
</label></td>
<td width="203">เวลา :
<label> <? echo date("H:i:s");?></label></td>
</tr>
</table>
<table width="800" border="0" align="center">
<tr align="center">
<td><legend align="left" style="color:#09F">รายการสินค้า : </legend></td>
<td width="300">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr align="center" bgcolor="#66CCFF">
<td width="100"><font color="#FFFFFF">รหัสสินค้า</font></td>
<td width="300"><font color="#FFFFFF">ชื่อการค้า</font></td>
<td width="100"><font color="#FFFFFF">จำนวน</font></td>
<td width="100"><font color="#FFFFFF">ราคา/หน่วย</font></td>
<td width="100"><font color="#FFFFFF">จำนวนเงิน</font></td>
<td width="100"><font color="#FFFFFF">ลบรายการ</font></td>
</tr>
<?

if($_POST['act']==add){
$sqlPro="select * from product where pro_id = '$_POST[proId]'";
$rePro=mysql_query($sqlPro);
$resultPro=mysql_fetch_array($rePro);

$sqlAddPro="insert into sell_detail_temp (pro_id,pro_name,sale_qty,amount,cus_id) values('$resultPro[pro_id]','$resultPro[pro_name]','$_POST[sale_qty]','$resultPro[price]','$sess_cusid')";
$ok=mysql_query($sqlAddPro) ;
$_POST[act] = wait;
}
else if($_POST[act]==del){
$sqlDel="DELETE FROM sell_detail_temp WHERE id_saleDetail = '$_POST[deleteId]' and cus_id='$sess_cusid'";	
$ok=mysql_query($sqlDel);
$_POST[act] = wait;
}

if($_POST[act]== wait){
?>
<script language="javascript">
window.location="Form_Sell.php";
</script>
<? }

?>
<form id="formSell" name="formSell" method="post" action="Form_Sell.php">
<?
$sql="select * from sell_detail_temp where cus_id='$sess_cusid'";
$dbquery=mysql_query($sql);
//if($dbquery) {


while($row=mysql_fetch_array($dbquery)){

echo("<tr align=\"center\" bgcolor=\"#CCFFFF\">");
echo("<td>".$row["pro_id"]."</td>");
echo("<td>".$row["pro_name"]."</td>");
echo("<td>".$row["sale_qty"]."</td>");
echo("<td>".$row["amount"]."</td>");
echo("<td>".$row["sale_qty"]*$row["amount"]."</td>");
echo("<input type=\"hidden\" name=\"deleteId\" id=\"deleteId\" value=\"".$row["id_saleDetail"]."\" />");
echo("<input type=\"hidden\" name=\"act\" id=\"act\" value=\"del\" />");
echo("<td><input type=\"submit\" name=\"delete\" id=\"submit\" value=\"ลบ\" /></td>");
echo("</tr>");

$qPrice = $row["sale_qty"]*$row["amount"];
$totalPrice += $qPrice;

}
//}
?>
</form>
<tr align="center" bgcolor="#FFFFFF">
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<p>&nbsp;</p>
</fieldset>
<?php

if($_POST[act] == nCal){
$cash=$_POST[cash];
$change = $cash - $totalPrice;
}
?>
<form id="form3" name="form3" method="post" >
<table width="450" border="0" align="right" cellpadding="3">
<tr>
<td width="150" rowspan="3" align="right"><img src="image/buy/calculator2-icon.png" alt="" width="60" height="54" align="absmiddle" /></td>
<td width="150" align="right"><font size="+1" color="#0000FF">ยอดรวมสุทธิ :</font></td>
<td width="100" align="left">
<input name="total" type="text" id="total" value="<?=$totalPrice?>" size="10" readonly="readonly" /></td>
<td width="50"></td>
</tr>
<tr>
<td width="150" align="right"><font size="+1" color="#0000FF">รับเงินมา :</font></td>
<td width="100" align="left"><input name="cash" type="text" id="cash" size="10" value="<?=$cash?>" /></td>
<input type="hidden" name="act" id="act" value="nCal"/>
<td width="50" align="center"><input type="submit" name="button1" value="..." /></td>
</tr>
<tr>
<td width="150" align="right"><font size="+1" color="#0000FF">เงินทอน :</font></td>
<td width="100" align="left">
<input name="change" type="text" disabled="disabled" id="change" size="10" value="<?=$change?>" /></td>
<td width="50"></td>
</tr>
</table>
</form>
</table>
</fieldset>

<tr>
<td colspan="3" align="right">&nbsp;</td>
</tr>
<tr>
<td colspan="3" align="right"><table width="400" border="0" align="center">
<tr align="center">
<td width="200"><a href="send_save_sell_order_shop.php?total=<?=$totalPrice?>"> <img src="image/buy/save-icon.png" alt="" width="60" height="60" border="0" /></a></td>
</tr>
<tr align="center">
<td width="200"><font color="#CC0000">บันทึกการขาย</font></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<? mysql_close();?>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-02-15 00:49:15 By : weaned
 


 

No. 12



โพสกระทู้ ( 32 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

ได้แล้วค่ะ ขอบคุณทุกท่านมากค่ะ สำหรับความรู้และคำแนะนำดีๆนะค่ะ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-02-15 01:45:31 By : sunaree
 


 

No. 13



โพสกระทู้ ( 342 )
บทความ ( 2 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์



แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-02-15 17:44:07 By : weaned
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : มาช่วยจับผิดให้หน่อยนะค่ะ ข้อมูลมันแสดงได้อย่างไร งงค่ะ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 04
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่