07-04-1394، 03:21 ب.ظ
سلام وقت بخیر دوستان مشکل این کدها چیه به نظر شما
این خطا رو میده
<!DOCTYPE html> <html> <body> <?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "alex"; // Create connection $conn = mysqli_connect($servername, $username, $password, $dbname); // Check connection if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } $sql = "SELECT `id`,`food`, `colories` FROM `foods` ORDER BY `id`"; $result = mysqli_query($conn, $sql); if (mysqli_num_rows($result) > 0) { // output data of each row while($row = mysqli_fetch_assoc($result)) { echo "id: " . $row["id"]. " - Name: " . $row["food"]. " " . $row["calories"]. "<br>"; } } else { echo "0 results"; } mysqli_close($conn); ?> </body> </html>
این خطا رو میده
کد:
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in0 results