数据无法在MySQL数据库中成功更新

时间:2019-07-19 17:42:02

标签: php mysql

我创建了一个名为anirban的数据库,并在其中创建了两个表admintestteamtest。我已经编写了PHP脚本来插入数据,但不能更新数据。

databaseConfig.php

<?php

//Define your host here.
$HostName = "localhost";

//Define your database username here.
$HostUser = "root";

//Define your database password here.
$HostPass = "";

//$HostServer = "localhost";

//Define your database name here.
$DatabaseName = "anirban";

admintest1Get_data.php

<?php

include 'databaseConfig.php';

$con = mysqli_connect($HostName, $HostUser, $HostPass, $DatabaseName);

$name = isset($_POST['name']) ? $_POST['name'] : '';

$email = isset($_POST['email']) ? $_POST['email'] : '';

$phone = isset($_POST['phone']) ? $_POST['phone'] : '';

$location = isset($_POST['location']) ? $_POST['location'] : '';

$landmark = isset($_POST['landmark']) ? $_POST['landmark'] : '';

$details = isset($_POST['details']) ? $_POST['details'] : '';

$password = isset($_POST['password']) ? $_POST['password'] : '';

$Sql_Query = "insert into admintest 
(name,email,phone,location,landmark,details,password) values ('$name','$email','$phone','$location','$landmark','$details','$password')";

if (mysqli_query($con, $Sql_Query)) {
    echo 'Data Submit Successfully';
} else {
    echo 'Try Again';
}
mysqli_close($con);

0 个答案:

没有答案