我想要注册表格。但是我无法将数据插入到我的数据库表格中#34; yeni" 并得到"错误...... !!"。我真的需要解决这个问题,伙计们请帮助我。
http://i.stack.imgur.com/SoCNK.png
$(document).ready(function() {
$("#register").click(function() {
var name = $("#name").val();
var tc = $("#tc").val();
var tel = $("#tel").val();
var password = $("#password").val();
var cpassword = $("#cpassword").val();
if (name == '' || tc == '' || tel == '' || password == '' || cpassword == '') {
alert("Please fill all fields...!!!!!!");
}
else if ((password.length) < 8) {
alert("Password should atleast 8 character in length...!!!!!!");
}
else if (!(password).match(cpassword)) {
alert("Your passwords don't match. Try again?");
}
else {
$.post("sign.php", {
name1: name,
tc1:tc,
tel1: tel,
password1: password
}, function(data) {
if (data == 'You have Successfully Registered.....') {
$("form")[0].reset();
}
alert(data);
});
}
});
});
<?php
$connection = @mysql_connect("localhost", "root", "");
$db = mysql_select_db("babo", $connection);
$name = $_POST['name1']; // Fetching Values from URL.
$tc = $_POST['tc1'];
$tel = $_POST['tel1'];
$password = sha1($_POST['password1']);
$query = mysql_query("insert into yeni(adi, tc_no, password, tel) values ('$name', '$tc', '$password', '$tel')");
if($query) {
echo "You have Successfully Registered.....";
} else {
echo "Error....!!";
}
mysql_close ($connection);
?>
答案 0 :(得分:1)
echo "Error....!!";
替换为echo mysqli_error($connection);