我有这段代码将inf插入我的数据库。 它实际上工作昨晚,今天我不能让它工作..
<?php
session_start();
include 'dbh.php';
$first = $_POST['first'];
$last = $_POST['last'];
$email = $_POST['email'];
$username = $_POST['username'];
$pwd = $_POST['pwd'];
$pwd2 = $_POST['pwd2'];
$some = $_POST['some'];
if ($pwd == $pwd2){
$pwd = ($pwd);
$sql = "INSERT INTO user (first, last, email, ip, username, pwd,
pwd2, some, )
VALUES ('$first', '$last', '$email', '$ipaddress', '$username', '
$pwd', '$pwd2', '$some',)";
$result = $conn->query($sql);
$_conn['message'] = " in";
header("Location: somepage.php");
} else {
//failed
$_conn['message'] = "Passwords do not match";
}
?>
以上内容不会在我的数据库中插入任何数据。 但是当我使用像:
这样的简单函数时 $sql = "INSERT INTO user (first, last, email)
VALUES ('mine', 'you', 'my.you@some.com')";
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
之前的道歉。
我仍在使用php和数据库。
任何帮助都将不胜感激。干杯 的米歇尔