الخطأ الدي يظهر :
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in D:\AppServ\www\testforeach\mune.php on line 8
الكود في المحرر:
function print_books($sql = ''){
$res = mysql_query($sql);
$i=0;
while ($book = mysql_fetch_assoc($res) ) {
?>
<div class="col-lg-6 col-md-6 ">
<img style="max-width: 100px;height: auto; "
src="<?php echo $book['image']; ?>">
<h2><?php echo $book['title']; ?></h2>
<h4>Author: <?php echo $book['name']; ?></h4>
<p>
<?php echo $book['brief']; ?>
</p>
<button class="btn btn-primary"><?php echo $book['price']; ?></button>
</div>
<?php
$i++;
if($i%2 == 0){
echo"<div class='clearfix'></div>";
}
التعليقات