-1
我在大約mysql_fetch_assoc代碼警告(),但我認爲代碼是罰款警告:mysqli_fetch_assoc()預計參數1被mysqli_result,布爾
<?php
$con = mysqli_connect("localhost","root","","profiles");
$q = mysqli_query($con,"SELECT * FROM users");
while($row = mysqli_fetch_assoc($q)){
echo $row['username'];
if($row['image'] == ""){
echo "<img width='100' height='100' src='pictures/default.jpg' alt='Default Profile Pic'>";
} else {
echo "<img width='100' height='100' src='pictures/".$row['image']."' alt='Profile Pic'>";
}
echo "<br>";
}
?>
您的查詢失敗。檢查'profiles'數據庫中是否真的存在表'users'。 –
問題主體說你正在使用'mysql_fetch_assoc()',是一個錯字? – chris85