 |
เกิดปัญหา Column count doesn match value count at row 1 จะแก้ยังไงดีครับ |
|
 |
|
|
 |
 |
|
รันแล้วมันแจ้งว่า Connected successfullyError: INSERT INTO tb_member VALUES ('12','','','','','','','')
Column count doesn't match value count at row 1
<?php
/*plant*/
$HostName = "localhost";
$HostUser = "root";
$HostPass = "";
$DatabaseName = "website";
$str_check_int ="";
$con = mysqli_connect($HostName, $HostUser, $HostPass, $DatabaseName);
if ($con->connect_error) {
die("Connection failed: " . $con->connect_error);
}
echo "Connected successfully";
$sql_max = "SELECT MAX(id_member) AS id_member FROM tb_member" ;
$sql_qury_max = mysqli_query($con,$sql_max);
$row_max = mysqli_fetch_array($sql_qury_max);
$row_max[0] += 1;
$str_check_int = $row_max[0];
$username = @$_POST["username"];
$password = @$_POST["password"];
$r_name = @$_POST["r_name"];
$r_weight = @$_POST["r_weight"];
$r_hight = @$_POST["r_hight"];
$r_old = @$_POST["r_old"];
$r_sex = @$_POST["r_sex"];
$sql = "INSERT INTO tb_member VALUES
('$str_check_int','$username','$password','$r_name','$r_weight','$r_hight','$r_old','$r_sex')";
if ($con->query($sql) == TRUE) {
echo "</br>New record created successfully";
}else {
echo "Error: " . $sql . "<br>" . $con->error;
}
?>
มือใหม่ในการสร้างกระทู้ครับ ขออภัยด้วยครับ
Tag : PHP, MySQL, XAMPP
|
ประวัติการแก้ไข 2020-04-01 09:59:48
|
 |
 |
 |
 |
Date :
2020-04-01 09:57:54 |
By :
puensx |
View :
1192 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตอนนี้แก้ไขได้แล้วครับ ขอบคุณครับ
|
 |
 |
 |
 |
Date :
2020-04-01 10:22:38 |
By :
puensx |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ศึกษา sql injection ด้วยล่ะ
|
 |
 |
 |
 |
Date :
2020-04-01 12:22:37 |
By :
Chaidhanan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|