如何解决不将数据复制到数据库[重复]

问题描述 投票:0回答:1

我正在使用MySQL和PHP为我的网站制作一个表单,所有连接都可以正常工作,并且没有收到任何错误,但是当我提交数据库时,nothig会在数据库中弹出,这是代码

<?php
$dbname='camivide_client-form';
$host='localhost';
$user='daniel';
$password='-xQ8yBH7BuBJXQb';
$con = @mysqli_connect($host, $user, $password, "camivide_client-form") or die('Database connection error');
echo 'Database has been connected succesfully'; // Selecting Database from Server
if(isset($_POST['submit'])){ // Fetching variables of the form which travels in URL
$fname = $_POST['fname'];
$mname = $_POST['mname'];
$lname = $_POST['lname'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$country = $_POST['country'];
$address = $_POST['address'];
if($fname !=''||$email !=''){
//Insert Query of SQL
$query = mysql_query("insert into form(id, fname, mname, lname, email, phone, country, address,) values ('$id', '$fname', '$mname', '$lname', '$email', '$phone', '$country', '$address')");
echo "<br/><br/><span>Data Inserted successfully...!!</span>";
}
else{
echo "<p>Insertion Failed <br/> Some Fields are Blank....!!</p>";
}
}
mysql_close($con); // Closing Connection with Server
?>

这是另一页代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Admin Fill Form</title>
</head>
<body>
    <form action="connect.php" method="POST">
        <input disabled type="text" name="admin" placeholder="Admin">
        <label>Subject</label>
        <input type="text" name="subject" placeholder="Enter Subject Here">
        <label>Reason</label>
        <select name="reason" title="Pick a Reason">
        <option>Pick a Reason</option>
        <option>Ban a User</option>
        <option>Temp ban a User</option>
        <option>Open Dispute</option>
        <option>Settle a Dispute</option>
        <option>Issue a Refund</option>
        <option>Cancel an Order</option>
        <option>Change account Info</option>
        <option>Other</option>
        </select>
    <label>User Involed</label>
    <input type="text" name="user" placeholder="User">
    <label>Description</label>
    <input type="text" name="description" placeholder="Description">
    <button type="submit" name="submit">Submit</button>
    </form>
</body>
</html>

当我单击提交时,它说“数据库已成功连接,您的表单已成功提交”,当我检查数据库时,那里什么也没有]]

我正在使用MySQL和PHP为我的网站制作一个表单,所有连接都可以正常工作,但是没有错误,但是当提交代码时,nothig会在数据库中弹出

php mysql
1个回答
0
投票

您有一个逗号(address,)),因此它不是有效的查询。

© www.soinside.com 2019 - 2024. All rights reserved.