Ik ben bezig met een klein webshopje, maar ik heb nu een error die ik maar niet opgelost krijg.
Ik hoop dat jullie de fout zien!
De error:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\Users\Dees\Desktop\school\USBWebserver v8.5\8.5\root\products.php on line 41
De code:
PHP
<? php include("includes/db.php"); include("includes/functions.php"); if(isset($_REQUEST['command'])) { if(isset($_REQUEST['productid'])) { if($_REQUEST['command']=='add' && $_REQUEST['productid']>0) { $pid=$_REQUEST['productid']; addtocart($pid,1); header("location:shoppingcart.php"); exit(); } } }?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Products</title> <script language="javascript"> function addtocart(pid){ document.form1.productid.value=pid; document.form1.command.value='add'; document.form1.submit(); }</script></head><body> <form name="form1"> <input type="hidden" name="productid" /> <input type="hidden" name="command" /> </form> <div align="center"> <h1 align="center">Products</h1> <table border="0" cellpadding="2px" width="600px"> <?php $result = mysql_query("SELECT description FROM `products`"); while($row = mysql_fetch_array($result)){ ?> <tr> <td><img src="<?=$row['picture']?>" /></td> <td> <b><?=$row['name']?></b><br /> <?=$row['description']?><br /> Price:<big style="color:green"> $<?=$row['price']?></big><br /><br /> <input type="button" value="Add to Cart" onclick="addtocart(<?=$row['serial']?>)" /> </td> </tr> <tr><td colspan="2"><hr size="1" /></td><?php } ?> </table> </div></body></html>
op een of andere manier krijg ik de code niet goed, nu worden ze achter elkaar gezet inplaats van onderelkaar..?