내 양식을 제출하려고 할 때 나는 다음과 같은 오류가 점점 오전 : 나는 같은 오류와 함께 다른 모든 게시물을 검사 한PHP의 mysqli_stmt_execute() 오류
Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, boolean given in /Applications/MAMP/htdocs/phpv1/v1/editprofilephp.php on line 66
Warning: mysqli_stmt_affected_rows() expects parameter 1 to be mysqli_stmt, boolean given in /Applications/MAMP/htdocs/phpv1/v1/editprofilephp.php on line 68
Error Occurred
Warning: mysqli_error() expects exactly 1 parameter, 0 given in /Applications/MAMP/htdocs/phpv1/v1/editprofilephp.php on line 83
Warning: mysqli_stmt_close() expects parameter 1 to be mysqli_stmt, boolean given in /Applications/MAMP/htdocs/phpv1/v1/editprofilephp.php on line 85
을 내가 실수 중 하나를하지 않았 그 (것)들에서 언급되는.
내 PHP는 : 나는 다른 목적을 위해 웹 사이트의 이전 섹션에서 이전에이 코드를 사용하고 난 아무 문제가 없었어요
<?php
session_start();
if(isset($_POST['submit'])){
$data_missing = array();
if(empty($_POST['aboutme'])){
// Adds name to array
$data_missing[] = 'aboutme';
} else {
// Trim white space from the name and store the name
$aboutme = trim($_POST['aboutme']);
}
if(empty($_POST['full_name'])){
// Adds name to array
$data_missing[] = 'full_name';
} else {
// Trim white space from the name and store the name
$full_name = trim($_POST['full_name']);
}
if(empty($_POST['friend'])){
// Adds name to array
$data_missing[] = 'friend';
} else {
// Trim white space from the name and store the name
$friend = trim($_POST['friend']);
}
if(empty($data_missing)){
$id = $_SESSION["user_id"];
require_once('mysqli_connect.php');
$query = "UPDATE userprofile SET full_name='{$full_name}' aboutme='{$aboutme}' friend='{$friend}' WHERE id='{$id}' LIMIT 1";
$stmt = mysqli_prepare($dbc, $query);
//i Interger
//d Doubles
//s Everything Else
mysqli_stmt_execute($stmt);
$affected_rows = mysqli_stmt_affected_rows($stmt);
if($affected_rows == 1){
echo 'Student Entered';
mysqli_stmt_close($stmt);
mysqli_close($dbc);
} else {
echo 'Error Occurred<br />';
echo mysqli_error();
mysqli_stmt_close($stmt);
mysqli_close($dbc);
}
} else {
echo 'You need to enter the following data<br />';
foreach($data_missing as $missing){
echo "$missing<br />";
}
}
}else {
echo mysqli_error();
}
?>
. 나는 오랜 시간 동안 오류를 찾는데 아무런 노력을 기울이지 않았고 성공을 거두지 않았기 때문에 여기서 물어보기로했다.
왜 *없이 문 *을 준비'있다'그것에서의? 사용자가 입력 한 값을 SQL 쿼리에 연결하는 것은 탈출이나 위생 처리가 없으므로 끔찍한 생각입니다. –