-1
MySQL에 데이터를 삽입하려고하는데 작동하지 않습니다. 이 코드에는 오류가 표시되지 않습니다.MySQL에 데이터를 삽입하려고하는데 오류가 없지만 데이터가 삽입되지 않습니까?
<?php
$connection = mysqli_connect("localhost", "root", "");
if(!$connection) {
echo 'Server Not Found';
}
else {
echo 'Server Found';
}
// Establishing Connection with Server
$db = mysqli_select_db($connection,"colleges"); // Selecting Database from Server
if (!$db) {
echo 'Databaje Not Found';
}
else {
echo 'Databaje found';
}
if(isset($_POST['submit'])) { // Fetching variables of the form which travels in URL
$name = $_POST['name'];
$email = $_POST['email'];
$contact = $_POST['contact'];
$address = $_POST['address'];
if($name !=''||$email !='') {
//Insert Query of SQL
$query = mysqli_query("insert into students(student_name, student_email, student_contact,student_adress) values ('$name', '$email', '$contact', '$address')", $connection);
echo "<br/><br/><span>Data Inserted successfully...!!</span>";
}
else {
echo "<p>Insertion Failed <br/> Some Fields are Blank....!!</p>";
}
}
mysqli_close($connection); // Closing Connection with Server
?>
응답으로 나타나는 에코 메시지는 무엇입니까? – Ma3x
'student_adress'는'student_address' 여야합니다. – Carl
$ 연결은 mysqli_query()에 먼저옵니다. – nogad