|
 |
|
มัน Error ว่า Column count doesn't match value count at row 1 แต่หาไม่เจอ |
|
 |
|
|
 |
 |
|
Code (PHP)
<?
if(isset($_POST['date_txt'])){
$objsql="INSERT INTO tb_asset(receiveDate,year,class,type,owner,code,code_tcc,sn,des,price,po,pv,department,occupant,place,company,buy_from,status,notes,files)";
$objsql .="VALUES";
$objsql .="('".$_POST["date_txt"]."','".$_POST["year_txt"]."','".$_POST["class_txt"]."','".$_POST["type_txt"]."','".$_POST["owner_txt"]."','".$_POST["code_txt"]."','".$_POST["codetcc_txt"]."' ";
$objsql .=",'".$_POST["sn_txt"]."','".$_POST["des_txt"]."','".$_POST["price_txt"]."','".$_POST["po_txt"]."','".$_POST["pv_txt"]."','".$_POST["depart_txt"]."','".$_POST["occu_txt"]."' ";
$objsql .=",'".$_POST["place_txt"]."' '".$_POST["comp_txt"]."','".$_POST["buy_txt"]."','".$_POST["status_txt"]."','".$_POST["notes_txt"]."','".$_FILES["files_uploads"]["name"]."' )";
$objquery=mysql_query($objsql) or die (mysql_error());
echo "SQL : $objsql";
if($objquery){
echo"Save Done.";
//header( "location:index.php" );
//exit(0);
}else{
echo"Not recorded ";
}
}
?>
Tag : PHP, MySQL, HTML/CSS

|
|
 |
 |
 |
 |
Date :
2014-07-28 14:29:57 |
By :
nottpoo |
View :
2118 |
Reply :
6 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใน () กับหลัง Value ไม่เท่ากัน
ใน () = 19
หลัง value = 20
|
 |
 |
 |
 |
Date :
2014-07-28 14:33:16 |
By :
progamer2000 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
นับได้ 20 เท่ากันน๊า เรา งง อ่ะ
|
 |
 |
 |
 |
Date :
2014-07-28 15:30:00 |
By :
nottpoo |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เออเท่ากันแฮะ แล้วลอง echo ค่ามาดูละลองไปแปะใน phpmyadmin หรือยัง หรือ โปรแกรม mysql front
|
 |
 |
 |
 |
Date :
2014-07-28 15:33:34 |
By :
progamer2000 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?php
if(isset($_POST['date_txt'])){
$objsql="INSERT INTO tb_asset(receiveDate,year,class,type,owner,code,code_tcc,sn,des,price,po,pv,department,occupant,place,company,buy_from,status,notes,files)";
$objsql .="VALUES";
$objsql .="('".$_POST["date_txt"]."','".$_POST["year_txt"]."','".$_POST["class_txt"]."','".$_POST["type_txt"]."','".$_POST["owner_txt"]."','".$_POST["code_txt"]."','".$_POST["codetcc_txt"]."' ";
$objsql .=",'".$_POST["sn_txt"]."','".$_POST["des_txt"]."','".$_POST["price_txt"]."','".$_POST["po_txt"]."','".$_POST["pv_txt"]."','".$_POST["depart_txt"]."','".$_POST["occu_txt"]."' ";
$objsql .=",'".$_POST["place_txt"]."' ,'".$_POST["comp_txt"]."','".$_POST["buy_txt"]."','".$_POST["status_txt"]."','".$_POST["notes_txt"]."','".$_FILES["files_uploads"]["name"]."' )";
$objquery=mysql_query($objsql) or die (mysql_error());
echo "SQL : $objsql";
if($objquery){
echo"Save Done.";
//header( "location:index.php" );
//exit(0);
}else{
echo"Not recorded ";
}
}
?>
|
 |
 |
 |
 |
Date :
2014-07-29 10:10:07 |
By :
compiak |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
โค้ด ของคุณ OMG_PIAK ได้นะ แต่ว่า โค้ดเรา มันผิดตรงไหน อ๊า เรายังหาไม่เจอ เลย
ถามต่อ อีกนิดหนึ่ง โค้ดส่วน upload to Mysql
มันอัพไม่ได้
Code (PHP)
<?
$file = strtolower($_FILES["fileupload"]["name"]);
$sizefile = $_FILES["fileupload"]["size"];
$type= strrchr($file,".");
if($sizefile>204800){
echo "<script>alert('$sizefile/1024')</script>";
}elseif(($type==".jpg")||($type==".jpeg")||($type==".gif")||($type==".png")||($type==".pdf")||($type==".tif")||($type==".tiff")){
$tempfile = date("Y-m-d")."-".$file;
copy($_FILES["fileupload"]["tmp_name"],$tempfile);
echo "<script>alert('$tempfile')</script>";
}else{
echo "<script>alert('".$_FILES['filepload']['name']."');</script>";
}
?>
<?
if(isset($_POST['date_txt'])){
$objsql="INSERT INTO tb_asset(receiveDate,year,class,type,owner,code,code_tcc,sn,des,price,po,pv,department,occupant,place,company,buy_from,status,notes,files)";
$objsql .="VALUES";
$objsql .="('".$_POST["date_txt"]."','".$_POST["year_txt"]."','".$_POST["class_txt"]."','".$_POST["type_txt"]."','".$_POST["owner_txt"]."','".$_POST["code_txt"]."','".$_POST["codetcc_txt"]."' ";
$objsql .=",'".$_POST["sn_txt"]."','".$_POST["des_txt"]."','".$_POST["price_txt"]."','".$_POST["po_txt"]."','".$_POST["pv_txt"]."','".$_POST["depart_txt"]."','".$_POST["occu_txt"]."' ";
$objsql .=",'".$_POST["place_txt"]."' ,'".$_POST["comp_txt"]."','".$_POST["buy_txt"]."','".$_POST["status_txt"]."','".$_POST["notes_txt"]."','".$_FILES["files_uploads"]["name"]."' )";
$objquery=mysql_query($objsql) or die (mysql_error());
echo "SQL : $objsql";
if($objquery){
echo"Save Done.";
//header( "location:index.php" );
//exit(0);
}else{
echo"Not recorded ";
}
}
?>
|
ประวัติการแก้ไข 2014-07-29 11:35:44 2014-07-29 12:22:28
 |
 |
 |
 |
Date :
2014-07-29 11:17:57 |
By :
nottpoo |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
'".$_POST["place_txt"]."' '".$_POST["comp_txt"]."'
ขาดตัวนี้ , ขั้นครับ
ส่วนอัพโหลด มีคนบอกวิธีเยอะแยะครับ ลอง search ดูครับ 
|
ประวัติการแก้ไข 2014-07-30 16:06:01
 |
 |
 |
 |
Date :
2014-07-30 16:05:37 |
By :
compiak |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|