注册表单引导PHP
我的表格有问题。 我想使用电子邮件和密码创建注册表。 但它并没有插入到我的数据库中 我正确地包含了数据库连接,但我不知道为什么它没有插入 这是我的PHP注册注册表单引导PHP,php,html,twitter-bootstrap,Php,Html,Twitter Bootstrap,我的表格有问题。 我想使用电子邮件和密码创建注册表。 但它并没有插入到我的数据库中 我正确地包含了数据库连接,但我不知道为什么它没有插入 这是我的PHP注册 <?php include ("dbconnection.php"); if(isset($_POST['submit'])) { //gather all the data from the submission process $email = $_POST['email']; $password
<?php
include ("dbconnection.php");
if(isset($_POST['submit'])) {
//gather all the data from the submission process
$email = $_POST['email'];
$password = $_POST['password'];
date_default_timezone_set('Asia/Manila');
$date_created = date('D, d M o h:i:s O', time());
$password = md5($password);
$check_email = mysql_query("SELECT email FROM tbl_clients WHERE email = '$email'") ;
$checked_email = mysql_num_rows($check_email);
if($checked_email != 0) {
echo"<script>alert('Sorry that email is already taken')</script>";
}
else {
$query = "INSERT INTO tbl_registration (email,
password,
created) VALUE
('".$email."',
'".$password."',
".$date_created.")";
$result = mysql_query($query);
echo"<script>alert('Thank you for registering. Your registration is successful!')
</script>";
}
}
?>
您需要写入值而不是值
$query = "INSERT INTO tbl_registration (email,
password,
created) VALUES
('".$email."',
'".$password."',
".$date_created.")";
顺便说一句,我建议你修改密码。它们不再得到维护。看到了吗?相反,学习,并使用or-将帮助您决定哪一个。如果您选择PDO,。另外,请使用除MD5
LOL以外的其他内容,如sha256
谢谢您的建议:)MD5
将被视为是可以的,只要它是咸的和散列的。与sha256和任何其他加密相同@EliteGamerI更新了它,但什么也没发生。不过谢谢你,顺便说一句,我忘了写“S”
$query = "INSERT INTO tbl_registration (email,
password,
created) VALUES
('".$email."',
'".$password."',
".$date_created.")";