0
我在上個小時試圖解決這個問題。我有一個很長的形式,我試圖將信息上傳到MySQL數據庫。進入我製作的桌子。這是我使用的MySQL查詢:查詢Mysql的麻煩:上傳
mysql_query("INSERT INTO `users_temp`(`first_name`, `surname`, `birthday`, `nationality`, `email`, `mobile`, `landline`, `address`, `town`, `post_code`, `country`, `password`, `code_conf`) VALUES ([$f_name],[$s_name],[$bday],[$nationality],[$email],[$mobile],[$landline],[$address],[$town],[$post_code],[$country],[$pass],[$conf_code])");
如果有人看到任何問題,爲什麼它不起作用請讓我知道。謝謝...
$f_name = $_POST["f_name"];
$s_name = $_POST["s_name"];
$pass = $_POST["pass"];
$birthday = $_POST["bday"];
$nationality = $_POST["nationality"];
$email = $_POST["email"];
$mobile = $_POST["mobile"];
$landline = $_POST["landline"];
$address = $_POST["address"];
$town = $_POST["town"];
$post_code = $_POST["post_code"];
$country = $_POST["country"];
$conf_code = substr(md5(uniqid(rand(), true)), 1, 70);
include("connect_into_mysql.php");
mysql_select_db("jzperson_edu", $conn);
$res_01 = mysql_query("SELECT * FROM users WHERE email='$email'");
$count_01 = mysql_num_rows($res_01);
if($count_01==0)
{
mysql_query("INSERT INTO users_temp ('first_name','surname','birthday','nationality','email','mobile','landline','address','town','post_code','country','password','code_conf') VALUES ('$f_name','$s_name','$bday','$nationality','$email','$mobile','$landline','$address','$town','$post_code','$country','$pass','$conf_code')");
header("Location: home.php");
}else{echo "This email is already registered. If you lost your password you can reset it here.";}
你有什麼錯誤嗎?你是否清理了你放入數據庫的變量? ps,你可以使用'{$ varname}'或''。$ varname。',而不是'[$ varname]' –
我會把整個代碼置於問題中。我正在編輯它。 –
什麼是確切的錯誤信息?並請刪除方括號[]並再次嘗試。你現在有什麼錯誤信息? –