I'm not sure if this is related to the webhost's change to PHP 5.3 too but there is just one other area that is suddenly causing a problem, though it was fine for 4 years until recently and is not to do with date format this time. It is this...
The error message is...
Warning: extract() expects parameter 1 to be array, boolean given in .../httpdocs/admin/product/modify.php on line 20
Notice: Undefined variable: cat_id in .../httpdocs/admin/product/modify.php on line 52
and the code it seems to refer to in the file modify.php is this....
<?php
if (!defined('WEB_ROOT')) {
exit;
}
// make sure a product id exists
if (isset($_GET['productId']) && $_GET['productId'] > 0) {
$productId = $_GET['productId'];
} else {
// redirect to index.php if product id is not present
header('Location: index.php');
}
// get product info
$sql = "SELECT *
FROM tbl_product pd, tbl_category cat
WHERE pd.pd_id = $productId AND pd.cat_id = cat.cat_id";
$result = mysql_query($sql) or die('Cannot get product. ' . mysql_error());
$row = mysql_fetch_assoc($result);
extract($row);
// get category list
$sql = "SELECT cat_id, cat_parent_id, cat_name
FROM tbl_category
ORDER BY cat_id";
$result = dbQuery($sql) or die('Cannot get Product. ' . mysql_error());
$categories = array();
while($row = dbFetchArray($result)) {
list($id, $parentId, $name) = $row;
if ($parentId == 0) {
$categories[$id] = array('name' => $name, 'children' => array());
} else {
$categories[$parentId]['children'][] = array('id' => $id, 'name' => $name);
}
}
//echo '<pre>'; print_r($categories); echo '</pre>'; exit;
// build combo box options
$list = '';
foreach ($categories as $key => $value) {
$name = $value['name'];
$children = $value['children'];
$list .= "<optgroup label=\"$name\">";
foreach ($children as $child) {
$list .= "<option value=\"{$child['id']}\"";
if ($child['id'] == $cat_id) {
$list .= " selected";
}
$list .= ">{$child['name']}</option>";
}
$list .= "</optgroup>";
}
?>
<form action="processProduct.php?action=modifyProduct&productId=<?php echo $productId; ?>" method="post" enctype="multipart/form-data" name="frmAddProduct" id="frmAddProduct">
<p align="center" class="formTitle">Modify Product</p>
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" class="entryTable">
<tr>
<td width="150" class="label">Category</td>
<td class="content"> <select name="cboCategory" id="cboCategory" class="box">
<option value="" selected>-- Choose Category --</option>
<?php
echo $list;
?>
- <?php
- if (!defined('WEB_ROOT')) {
- exit;
- }
- // make sure a product id exists
- if (isset($_GET['productId']) && $_GET['productId'] > 0) {
- $productId = $_GET['productId'];
- } else {
- // redirect to index.php if product id is not present
- header('Location: index.php');
- }
- // get product info
- $sql = "SELECT *
- FROM tbl_product pd, tbl_category cat
- WHERE pd.pd_id = $productId AND pd.cat_id = cat.cat_id";
- $result = mysql_query($sql) or die('Cannot get product. ' . mysql_error());
- $row = mysql_fetch_assoc($result);
- extract($row);
- // get category list
- $sql = "SELECT cat_id, cat_parent_id, cat_name
- FROM tbl_category
- ORDER BY cat_id";
- $result = dbQuery($sql) or die('Cannot get Product. ' . mysql_error());
- $categories = array();
- while($row = dbFetchArray($result)) {
- list($id, $parentId, $name) = $row;
-
- if ($parentId == 0) {
- $categories[$id] = array('name' => $name, 'children' => array());
- } else {
- $categories[$parentId]['children'][] = array('id' => $id, 'name' => $name);
- }
- }
- //echo '<pre>'; print_r($categories); echo '</pre>'; exit;
- // build combo box options
- $list = '';
- foreach ($categories as $key => $value) {
- $name = $value['name'];
- $children = $value['children'];
-
- $list .= "<optgroup label=\"$name\">";
-
- foreach ($children as $child) {
- $list .= "<option value=\"{$child['id']}\"";
-
- if ($child['id'] == $cat_id) {
- $list .= " selected";
- }
- $list .= ">{$child['name']}</option>";
- }
-
- $list .= "</optgroup>";
- }
- ?>
- <form action="processProduct.php?action=modifyProduct&productId=<?php echo $productId; ?>" method="post" enctype="multipart/form-data" name="frmAddProduct" id="frmAddProduct">
- <p align="center" class="formTitle">Modify Product</p>
-
- <table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" class="entryTable">
- <tr>
- <td width="150" class="label">Category</td>
- <td class="content"> <select name="cboCategory" id="cboCategory" class="box">
- <option value="" selected>-- Choose Category --</option>
- <?php
- echo $list;
- ?>
There is a bit more code on the page but I copied way past line 52, so hope that will do.
Again, I don't know anything about arrays or variables, I'm afraid.
The effect of that problem is, if I opened the site's admin, having left it logged in, it used to display the last admin page I was on, showing a list of categories or items etc., now it gives this...

It still works, I just have to choose the section from the menu but, as I say, it didn't used to display these errors, it properly displayed the last page I was on.
If I've logged out and log in afresh I don't get that scrambled page since it automatically takes me to the admin home page when newly logged in, it's only when I go back after closing the page but still logged in.
It's not a huge problem, it's just irritating and I don't know why it suddenly changed when it was fine for years and I don't think I changed anything on that file at all.
Regards,
Cerio