รายละเอียดของการตอบ ::
ขึ้น error ตามนี้ครับ ท่าน Chaidhanan
Notice: Undefined variable: sql in D:\xampp\htdocs\myphp\testsave.php on line 15
Warning: mysqli::query() [mysqli.query]: Empty query in D:\xampp\htdocs\myphp\testsave.php on line 15
Notice: Undefined variable: sql in D:\xampp\htdocs\myphp\testsave.php on line 15
<html>
<head>
<title>ThaiCreate.Com PHP & MySQL (mysqli)</title>
</head>
<body>
<?php
//ini_set('display_errors', 1);
//error_reporting(~0);
//$serverName = "localhost";
//$userName = "root";
//$userPassword = "";
//$dbName = "boiler";
$db = new mysqli( 'localhost', 'root', '', 'boiler');
$db->query($sql) or die( $sql . '<br>'. $db->error );
echo $db->affected_rows;
//$conn = mysqli_connect($serverName,$userName,$userPassword,$dbName);
$sql = "INSERT INTO equip (KKS, dwg, equip, desc, model, picture)
VALUES ('".$_POST["KKS"]."','".$_POST["dwg"]."','".$_POST["equip"]."'
,'".$_POST["desc"]."','".$_POST["model"]."','".$_POST["picture"]."')";
$query = mysqli_query($conn,$sql) ;
//echo $query;
//echo $_POST["desc"];
if(!$query) {
echo "No data recorded";
}
else {
echo "Record add successfully , Error : ".mysqli_error($conn);
}
mysqli_close($conn);
?>
</body>
</html>