當我運行這段代碼,始終顯示在網頁「結果錯誤」或「沒有數據即時拍攝」知道我添加在數據庫中的數據:其中是錯誤的始終顯示「結果錯誤」
<?php
if(isset($_POST['update']))
{
$data = getpost();
$search_Query = "SELECT * FROM employee WHERE user_id_assets = $data[0]";
$search_result = mysqli_query($conn , $search_Query);
if($search_result)
{
if(mysqli_num_rows($search_result))
{
while ($row = mysqli_fetch_array($search_result)) {
$user_id_assets = $row['user_id_assets'];
$name_emp = $row['name_emp'];
$user_account = $row['user_account'];
$mail_account = $row['mail_account'];
}
}else{
echo "no Data For This User ID";
}
}else {
echo "result Error";
}
} ?>
從這段代碼可以看出'$ conn'從來沒有定義過? –
似乎這個'$ data [0]'是空的/ null –
$ conn mighat已經在連接文件中定義了,代碼是不完整的... –