|
|
|
PHP Query Error รบกวนช่วยหาสาเหตุหน่อยครับ มันไม่สามารถ Query ได้ |
|
|
|
|
|
|
|
Code config.php
<?php
$host = "localhost";
$username = "root";
$password = "test";
$dbname = "testweb";
$connect = mysql_connect($host,$username,$password) or die("ติดต่อ Host ไม่ได้");
mysql_select_db($dbname) or die("ติดต่อ Database ไม่ได้");
mysql_query("SET NAMES UTF8");
?>
save.php
<?php
include('config.php');
error_reporting(0);
$textlogo = $_POST[textlogo];
$about = $_POST[about];
$home = $_POST[home];
$service = $_POST[service];
$gallery = $_POST[gallery];
$faq = $_POST[faq];
$contact = $_POST[contact];
$facebook = $_POST[facebook];
$instagram = $_POST[instagram];
$youtube = $_POST[youtube];
$logo= $_FILES["logo"]["name"];
if(empty($logo)) {
$logo = "logo.png";
$sql = "UPDATE setting (logo,txtlogo,about,home,service,gallery,faq,contact,facebook,instagram,youtube) VALUES ('$logo','$textlogo','$about','$home','$service','$gallery','$faq','$contact','$facebook','$instagram','$youtube')";
$query = mysql_query($sql,$connect) or die ("ERROR Query1");
if($query) {
echo ("<script>alert('บันทึกข้อมูลสำเร็จ');window.location='setting.php';</script>");
} else {
echo "ERROR 1";
}
} else {
$newname = "logo.png";
if(move_uploaded_file($_FILES["logo"]["tmp_name"],"images/".$newname))
{
$sql = "UPDATE setting (logo,txtlogo,about,home,service,gallery,faq,contact,facebook,instagram,youtube) VALUES ('$logo','$textlogo','$about','$home','$service','$gallery','$faq','$contact','$facebook','$instagram','$youtube')";
$query = mysql_query($sql,$connect) or die ("ERROR Query2");
if($query) {
echo ("<script>alert('บันทึกข้อมูลสำเร็จ');window.location='setting.php';</script>");
} else {
echo "ERROR 2";
}
}
}
?>
แจ้งเป็น Error Query ครับ
Tag : PHP
|
|
|
|
|
|
Date :
2016-07-26 18:41:44 |
By :
jwebshop |
View :
700 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code
$sql = "UPDATE setting (logo,txtlogo,about,home,service,gallery,faq,contact,facebook,instagram,youtube) VALUES ('$logo','$textlogo','$about','$home','$service','$gallery','$faq','$contact','$facebook','$instagram','$youtube')";
$query = mysql_query($sql,$connect) or die ("ERROR Query1");
ไปดู format คำสั่ง update ใหม่ครับ อย่าออกแบบเอง
|
|
|
|
|
Date :
2016-07-26 19:39:44 |
By :
Chaidhanan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|