我需要呼應job_id 1
, 所有的經驗,當我執行我的代碼,它提供了以下錯誤如何解決警告:mysqli_query()預計參數2爲字符串
警告:mysqli_query()預計參數2是字符串,
這裏是我的代碼,
<?php include_once 'db.php'; ?>
<form action='update.php' method='post'>
<table border='1'>
<?php
$sql = mysqli_query($con,"SELECT *FROM `experience` WHERE job_id=1");
$result= mysqli_query($con,$sql);
if ($result) {
// The query was successful!
}
else {
// The query failed. Show an error or something.
}
while($row = mysqli_fetch_array($result)){
echo "<tr>";
echo "<td><input type='hidden' name='experi_id[]' value='".$row['exp_id']."' /></td>";
echo "<td>Experince :<input type='text' name='experi[]' value='".$row['experience']."' /></td>";
echo "<td>year :<input type='text' name='year[]' value='".$row['year']."' /></td>";
echo "<td>job id :<input type='text' name='job_id[]' value='".$row['job_id']."' /></td>";
echo "</tr>";
}
echo "<input type='submit' name='update' value='UPDATE' />";
mysqli_close($con);
?>
<table>
</form>
如何解決這個錯誤嗎?
我無法看到你的代碼 –