Я новенький о PHP. Я создаю форму входа и после того, как я заполняю все поля ввода. Я нажал «SUBMIT», а затем он говорит .. «Количество столбцов не соответствует количеству значений в строке 1». кто-нибудь, помогите мне об этом. Я собираюсь с этим почти 1 неделю .. вот мой код. и мое соединение с БД.
<?php
$connection = mysqli_connect("localhost","root","","db_violation");
function DBCon(){
try{
$connection = new PDO("mysql:host=localhost;port=3306;dbname=db_violation;","root","");
return $connection;
}catch(PDOException $e){echo "Connection failed: ".$e->getMessage();}
}function DBDiscon(){return $connection = null;}
?>
<?php
include '../../PROCESS/dbconnect/dbconnect.php';
$datauserssystems = json_decode(file_get_contents("php://input"));
$user_firstname = mysqli_real_escape_string($connection, $datauserssystems->user_fname);
$user_middlename = mysqli_real_escape_string($connection, $datauserssystems->user_mname);
$user_lastname = mysqli_real_escape_string($connection, $datauserssystems->user_lname);
$user_address = mysqli_real_escape_string($connection, $datauserssystems->user_address);
$user_positionss = mysqli_real_escape_string($connection, $datauserssystems->user_positions);
$user_age = mysqli_real_escape_string($connection, $datauserssystems->user_age);
$user_username = mysqli_real_escape_string($connection, $datauserssystems->user_uname);
$user_userpass = mysqli_real_escape_string($connection, $datauserssystems->user_pwd);
$tableRows = DBCon()->prepare("SELECT COUNT (*) AS row FROM sb_account");
$tableRows->execute();
$count = $tableRows->fetch();
$count = ($count["row"]+1);
$gain ="SbAdmin";
$encrpt = md5($gain.$user_userpass);
$security = DBCon()->prepare("INSERT INTO sb_account_security VALUES('".$count."','".$encrpt."','".$user_userpass."')")->execute();
$sbuserssssquery = mysqli_query($connection, "SELECT * FROM sb_account WHERE sb_username='$user_username'");
$sbuserssssarray = mysqli_fetch_array($sbuserssssquery);
$sbuserssss = $sbuserssssarray['sb_username'];
if($sbuserssss == $user_username) {
echo "sbtwice";
die();
}
else {
mysqli_query($connection, "INSERT INTO sb_account (sb_firstname,sb_middlename,sb_lastname,sb_fullname,sb_address,sb_position,sb_age,sb_username,sb_password) VALUES ('$user_firstname','$user_middlename','$user_lastname','$user_address','$user_positionss','$user_age','$user_username','$encrpt')");
if(mysqli_affected_rows($connection) > 0) {
echo "AddUserSystem";
die();
}
else {
echo mysqli_error($connection);
die();
}
}
?>