Jump to content
Larry Ullman's Book Forums

Unclear About Error Message


Recommended Posts

Hi,

 

This question is about the 2nd ecommerce application (i.e. selling coffee). I loaded all the source code etc into a server to see what the site looks like before working through the chapters. (I also set up the databases and changed the htaccess file according to instructions).

 

When I load the site, however, I am getting this error message about home.html.

 

 

An error occurred in script '/blah/blah/views/home.html' on line 14:
mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given

 

 

So this is a database query that has not succeeded, but I don't know what created it. I'm not sure if my database connection has failed, or if it's a path problem, or another reason. Any ideas...

 

 

 

Looking at the source code, line 14 of home.html starts

 

if (mysqli_num_rows($r) > 0) {

echo '<dl class="special fright">
	<dt><a href="/shop/sales/">Sale Items</a></dt>';

// Fetch each item:
while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) {
	echo '<dd><a href="/shop/sales/#' . $row['sku'] . '" title="View This Product"><img alt="" src="/products/' . $row['image'] . '" /><span>' . $row['sale_price'] . '</span></a></dd>';
}

Link to comment
Share on other sites

 Share

×
×
  • Create New...