0

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean

I made a complete eCommerce website on my pc. Everything works properly, i then exported my databases to my laptop and i just copied my code files to my laptop as well. All the files; databases and programming files are exactly the same on my pc and laptop but for some reason i am getting the following error from my laptop on my shop page:Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean. Emphasize, i do not get this error on my pc although the databases and code are exactly the same. Please help. (xampp version is the same as well) Code: <center> <div id="mainProductDiv"> <?php while($row=mysql_fetch_array($result)){ ?> <div class="container"> <img src="<?php echo $row['Images']?>" alt="" class="image"> <div class="overlay"> <div class="text"> <a id="addToCart" onclick="numberCart()" href="?id=<?php echo $row['id']?>"> Add To Cart</a></div> </div> <h2>Price:R<?php echo $row['price'] ?></h2> </div> <?php } ?> </div> </center> Just in case you need to see what the result variable refers to, here is the related code from the beginning of my code: <?php session_start(); require 'connect.php'; mysql_select_db('shop',$conn); $sql='select * from products'; $result=mysql_query($sql); ?>

16th Apr 2018, 5:31 PM
Mogammad Shameer Losper
Mogammad Shameer Losper - avatar
2 Réponses