Silver Posted September 23, 2011 Share Posted September 23, 2011 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 More sharing options...
Silver Posted September 26, 2011 Author Share Posted September 26, 2011 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 More sharing options...
Larry Posted September 26, 2011 Share Posted September 26, 2011 It's not clear what error message you're getting. Are you saying that the error.html file is being shown? Link to comment Share on other sites More sharing options...
Silver Posted September 26, 2011 Author Share Posted September 26, 2011 Thanks Larry for the help. Yes “Error! Unfortunately a system error has occurred. ... We apologize for the inconvenience.” is displayed, which means the script includes the error.html rather than including list_coffees.html. Link to comment Share on other sites More sharing options...
Larry Posted September 26, 2011 Share Posted September 26, 2011 Okay, so your query isn't returning any records. You just need to apply the standard PHP-MySQL debugging techniques here to figure out why. Link to comment Share on other sites More sharing options...
Recommended Posts