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 : 074951



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



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




หน้า admin_prd

Code (PHP)
<?
session_start();
if ($sess_adminid<>session_id()) { 
	header( "Location: admin_index.php"); exit(); 
}
include "connect.php";
$sql="select * from products order by Pro_id desc";
mysql_query("SET NAMES utf8");
$result=mysql_db_query($dbname,$sql);
$number=mysql_num_rows($result);
$no=1;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title> Smile-IT สำหรับผู้ดูแลระบบ</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-image: url();
	background-repeat: no-repeat;
}
.style3 {color: #FFFFFF}
a:link {
	color: #0000FF;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #0000FF;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
.style4 {color: #FF0000}
-->
</style>
<script src="../Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>

<body>
<form id="form1" name="form1" method="post" action="admin_save.php">
  <div align="center">
    <table width="1217" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td height="235" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="312" height="234" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
              <!--DWLayoutTable-->
              <tr>
                <td height="234" colspan="2" valign="top"><img src="image/logo_zz.jpg" width="347" height="234" /></td>
                  </tr>
              <tr>
                <td width="315" height="1"></td>
                    <td width="315"></td>
                  </tr>
              </table></td>
              <td width="769" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                <!--DWLayoutTable-->
                <tr>
                  <td width="773" height="235" valign="top"><img src="image/bgweb2.jpg" width="903" height="234" /></td>
                  </tr>
              </table></td>
            </tr>
        </table></td>
      </tr>
      <tr>
        <td height="30" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="311" height="30" valign="top" bgcolor="#000000"><!--DWLayoutEmptyCell-->&nbsp;
           
            </td>
            </tr>
        </table></td>
        <td colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="10" height="30" valign="middle" bgcolor="#000000"> <div align="right" class="style3">
              <td width="830" height="30" valign="middle" bgcolor="#000000"> <div align="right" class="style3">
              <div align="center"></div>
            </div></td>
            </tr>
        </table></td>
      </tr>
      <tr>
        <td width="250" height="37">&nbsp;</td>
        <td colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="770" height="37" align="center" valign="middle"><div align="center">             </td>
          </tr>     
        </table></td>
        <td width="197" rowspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="197" height="198" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
            </tr>
          
          
          
        </table></td>
      </tr>
      
      <tr>
        <td height="161">&nbsp;</td>
        <td colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="770" height="112" valign="top"><?  include "admin_head.php"; ?>              &nbsp;</td>
            </tr>
          <tr>
            <td height="1"></td>
            </tr>
        </table></td>
      </tr>
      <tr>
        <td height="337" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="400" height="319"></td>
            <td width="512" valign="top"><table width="93%" border="0" cellpadding="0" cellspacing="0">
              <!--DWLayoutTable-->
              <tr>
                <td width="514" height="319" valign="top"><?
 if(count($_SESSION["sess_id"])==0){
			echo "ยังไม่มีสินค้าในตระกร้า";
		}
		else{
  echo"<table width=80% align=center bgcolor=#C1D6FF border=1 bordercolor=#000000>";
  echo"<tr>";
  echo"<th>รายการที่</th>";
  echo"<th>สินค้า</th>";
  echo"<th>จำนวน</th>";
  echo"</tr>";
  for($i=0;$i<count($_SESSION["sess_id"]);$i++){
				if(($_SESSION["sess_name"][$i]!="")&&($_SESSION["sess_name"][$i]!="-")){
					
			
					echo "<tr>";
					echo "<td align=center>".$_SESSION["sess_id"][$i]."</td>";
					echo "<td align=center>".$_SESSION["sess_name"][$i]."</td>";
					echo "<td align=center>".$_SESSION["sess_qty"][$i]."</td>";
					echo "</tr>";
  }
  }
  echo "</table>";
			}
		?>
                  <label><br />
                  </label>
                   <div align="right"></div>
                   <table width="480" border="0">
                     <!--DWLayoutTable-->
                    <tr>
                      <td width="11" height="59">&nbsp;</td>
                      <td width="132" valign="top"bordercolor="#00CCFF" bgcolor="#00CCCC"><div align="right"> ตัวแทนจำหน่าย : </div></td>
        <td width="173" valign="top"bordercolor="#00CCFF" bgcolor="#00CCCC"><div align="left"><label>                        <label><select name="seller" id="seller"></div>
                        <div align="center">
                          <option value="0"selected="selected" >กรุณาเลือก</option>
                          <?
  $sql3="select * from seller";                                   //การเลือกชนิดข้อมูล
  mysql_query("SET NAMES tis620");
$result3=mysql_db_query($dbname,$sql3);                   //นำคำสั่ง sql ไปประมวลผล
while($row3=mysql_fetch_array($result3)){                //นำข้อมูลแต่ละแถวเก็บที่ row
?>
                          <option value="<?=$row3[Sel_id]?>" >
                            <?=$row3[sellername]?>
    </option>
                          <?            
}
?>
                        </div>
                        </label></td>
                      <td width="136" valign="top" bordercolor="#00CCFF" bgcolor="#00CCCC"><input type="submit" name="button" id="button" value="ยืนยัน" /></td>
                    <td width="6">&nbsp;</td>
                    <tr>
                      <td height="18"></td>
                      <td></td>
                      <td></td>
                      <td></td>
                      <td></td>
                    </tr>
                  </table>
                  <div align="center"></div>
                  <label><br />
                  
                 
                  </label></td>
                </tr>
            </table></td>
            <td width="338"></td>
          </tr>
          <tr>
            <td height="18"></td>
            <td></td>
            <td></td>
          </tr>
          
          
          
        </table></td>
      </tr>
      <tr>
        <td height="47" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="1217" height="47" align="center" valign="top"><img src="../image/logolow.jpg" width="934" height="47" /></td>
            </tr>
        </table></td>
      </tr>
      <tr>
        <td height="825">&nbsp;</td>
        <td width="127">&nbsp;</td>
        <td width="643">&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>
  </div>
</form>
</body>
</html>


หน้าบันทึกข้อมูล

Code (PHP)
<? 
$Sel_id=$_POST[seller];
$orders_date=date("Y-m-d");
include "connect.php";
$sql="insert  into order_stock (orders_stockid,Sel_id,orders_date)value('','$Sel_id','$orders_date')";
mysql_query("SET NAMES utf8");
$result=mysql_db_query($dbname,$sql);
if ($result) {
	echo "<h3>การสั่งซื้อถูกบันทึกเรียบร้อยแล้ว</h3>";
}else{
    echo "<h3>ไม่สามารถบันทึกการสั่งซื้อได้</h3>";
}
$Pro_id=$_SESSION["sess_id"];
$qty=$_SESSION["sess_qty"];
$sql2="insert into order_stock_detail(order_stock_detail_id,Pro_id,qty)value('','$Pro_id','$qty')";
mysql_query("SET NAMES utf8");
$result2=mysql_db_query($dbname,$sql2)or die(mysql_error()." - SQL = ".$sql);;
if ($result2) {
	echo "<h3>รายละเอียดถูกบันทึกเรียบร้อยแล้ว</h3>";
}else{
    echo "<h3>ไม่สามารถบันทึกรายละเอียดได้</h3>";
}
?>


ปัญหาคือ $sql2 ไม่ยอมบันทึกข้อมูลลงในฐานข้อมูลครับผม รบกวนพี่ๆช่วยทีครับ เพราะจะต้องสอบโปรเจ็คแล้วแก้ปัญหาไม่ได้สักทีครับผม

error



Tag : PHP, CakePHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-03-03 16:14:02 By : kakeruna View : 873 Reply : 6
 

 

No. 1



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



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


ใช้ var_dump(); เซ็ค ตัวแปร $sql2 ก่อนลง DB ครับ ดูว่าค่ามันมาแบบไหน?
แล้วก็ ใน Database เรากำหนด Fields เป็นแบบไหนครับ ?

2 step ไล่บัค โค้ดง่ายๆครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-03-03 16:22:44 By : kitzz
 


 

No. 2



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



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


ลองแก้ DB ให้บันทึกเป็น Vachar แล้ว เหมือนเดิมครับผม จนปัญญา
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-03-03 16:27:11 By : kakeruna
 

 

No. 3



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



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


ตรวจดูครับ ว่าตั้งเป็น PK หรือไม่ ถ้า Fields นั้นเป็น PK ค่า value ห้ามซ้ำกันครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-03-03 16:35:43 By : kitzz
 


 

No. 4



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



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


บันทึกได้แล้วครับแต่ค่าจากแต่ค่าที่รับมาจาก Session กลับเป็น 0 ครับผม
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-03-03 16:42:55 By : kakeruna
 


 

No. 5



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

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

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

แสดงว่ามันไม่มีค่าครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-03-04 08:05:37 By : webmaster
 


 

No. 6



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



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


แบบนี้จะต้องทำไงดีครับพี่ ขอคำแนะนำหน่้อยครับผม
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-03-04 16:48:12 By : kakeruna
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
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 05
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 อัตราราคา คลิกที่นี่