Jump to content
Larry Ullman's Book Forums

Coffees On Index Page Without Goodies Or Sales


Recommended Posts

Both PHP and MysQl are release 5+

 

I failed several attempts to get coffee products in the index page without goodies or sales products. I already called the stored procedures in the command line and got the proper results, however, how to get those products listed on the index page is the problem. Because I am dealing with the index, home, browse, and list_coffees, and most have goodies and sales, things did not work for me. The way I want the index page is to list ALL coffees products in the same way as they appear in Fig. 8.4. All coffees in the DB should be listed in the first view box of the view/home.html page, leaving the second box as is. there would be no need for the header menus to reach to the coffees products as products would be listed on the index page, the first page visitor sees. How would I amend all the relevant pages?

Link to comment
Share on other sites

Regarding my problem, I achieved some progress but not what I wanted. Here is what my pages look like:

Index.php

<?php

require ('./includes/config.inc.php');

$page_title = 'whatever the final title might be';

include ('./includes/header.html');

include('./views/home.inc.php');

include ('./includes/footer.html');

?>

Home.inc.php

<?php

if (isset($_GET['type'], $_GET['category'], $_GET['id']) && filter_var($_GET['id'], FILTER_VALIDATE_INT, array('min_range' => 1))) {

$category = $_GET['category'];

$sp_cat = $_GET['id'];

if ($_GET['type'] == 'goodies') {

$sp_type = 'other';

$type = 'goodies';

} else {

$type = $sp_type = 'coffee';

}

}

require (MYSQL);

$r = mysqli_query($dbc, "CALL select_categories('$sp_type', $sp_cat)");

if (mysqli_num_rows($r) > 0) {

include ('/views/list_coffees.html');

} else {

include ('./views/error.html');

}

?>

So as you see, the index page includes the home page, which is significantly modified to allow for coffee products be displayed on the index page. All other pages and tables are kept per the book. Both PHP and MySql are release 5+. What I am getting now is the error message (last included page of the home.inc.php). Appreciate your help and guidance.

Link to comment
Share on other sites

 Share

×
×
  • Create New...