小弟用XAMPP試著上傳資料到mysql資料庫。
我上傳時沒有跳error出來,但mysql沒有我上傳的資料
請問這是什麼問題??(感恩)
<form name="file" method="POST" action="PHP/make_case.php">
<fieldset id="case1">
<div class="fielsettitle"><legend>個資</legend></div>
<p>
<label>email<input class="useremail" type="email" name="email" required></label>
<label>姓名<input class="username" type="text" name="username" required></label>
</p>
</fieldset>
<fieldset id="case2">
<div class="fielsettitle"><legend>case</legend></div>
<p>
<label>Case Title<input class="casetitle" type="text" name="casetitle" required></label>
<label>Case 說明<input class="casemain" type="text" name="casemain" required></label>
</p>
</fieldset>
<fieldset id="case3">
<div class="fielsettitle"><legend>人</legend></div>
<p>
<label>需要哪種人<input class="people" type="text" name="people" required></label>
</p>
</fieldset>
<center><input type='submit' value='提交'></center>
</form>
(make_case.php)
<?php
require_once("dbtools.inc.php");
$email=$_POST["email"];
$username=$_POST["username"];
$case_title=$_POST["casetitle"];
$case_discription=$_POST["casemain"];
$peoples=$_POST["people"];
$link=create_connection();
$sql="INSERT INTO people_data(name,email,casetitle,casemain,people)VALUES($username,$email,$case_title,$case_discription,$peoples)";
$result=execute_sql($link,"makecase",$sql);
// mysql_close($link);
// header("Location:/index.html")
?>
(dbtools.inc.php)
<?php
function create_connection()
{
$link = mysqli_connect("localhost", "root", "123456")
or die("無法建立資料連接: " . mysqli_connect_error());
mysqli_query($link, "SET NAMES utf8");
return $link;
}
function execute_sql($link, $database, $sql)
{
mysqli_select_db($link, $database)
or die("開啟資料庫失敗: " . mysqli_error($link));
$result = mysqli_query($link, $sql);
return $result;
}
?>
$sql="INSERT INTO people_data(name,email,casetitle,casemain,people) VALUES('".$username."','".$email."','".$case_title."','".$case_discription."','".$peoples."')";
(mack_case.php) => make_case.php
$sql="INSERT INTO people_data(name,email,casetitle,casemain,people)VALUES(
'{$username}',
'{$email}',
'{$case_title}',
'{$case_discription}',
'{$peoples}')";
改這樣試試
你好我改這樣還是不行,請問有沒有可能是因為我把make_case.php的
mysql_close($link)註解掉了?,因為我打上去它會跳error想說先註解掉因該不會有什麼影響,所以就註解掉了。
mysqli_query($link,$sql);
所以他跳了甚麼error?