I do have a PHP script with run fine on my local sever. When i do upload to the production sever it dose not function correctly.
My local sever uses Apache/2.2.22 (Win32) PHP/5.4.5.
Here is an example of the code.
PHP Code:
<?php
require_once('lib/bookmark_fns.php');
// The shopping cart needs sessions, so start one
session_start();
$itemId = $_GET['itemid'];
// get this book out of database
$items = get_item_details($itemId);
foreach($items as $item)
do_html_header($item['ITEM_NAME']);
check_valid_user();
display_item_details($items);
// set url for "continue button"
$target = "index.php";
if($itemId)
{
$target = "show_cat.php?catid=".$item['CATEGORY_ID'];
}
// if logged in as admin, show edit book links
if(check_admin_user())
{
display_button("edit_item_form.php?itemid=".$itemId, "edit-item", "Edit Item");
display_button("admin.php", "admin-menu", "Admin Menu");
//display_button($target, "continue", "Continue");
}
else
{
display_button("show_cart.php?new=".$itemId, "add-to-cart", "Add ".$item['ITEM_NAME']." To My Shopping Cart");
display_button($target, "continue-shopping", "Continue Shopping");
}
do_html_footer();
?>
Here is the problem, on my local sever I must include the foreach loop to access the array from the Sql query. On the production sever it tells me i do have an wrong foreach construct. Help please.
It would help to see the exact error message(s) you are getting. My guess is that the DB query is not working, and therefore $items is false or null instead of being an array, which is what the first argument to foreach() must be.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks