Variables not changing problem...
| From: | Nicholas A. Zukin | Date: | Thu, 23 Aug 2001 18:58:04 +0000 |
| Subject: | Variables not changing problem... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-64161@lists.php.net to get a copy of this message | ||
I'm using the function below to create a listing of name/value pairs to use in Flash. The first time it runs it works fine, but then after the first time, it uses the originally used variables. So if the URL looks like this:
mydomain.com/hum_images.php?hub_section=product&hub_subsection1=FOOTWEAR
The first time it will output correctly and the debugging lines will properly output:
FOOTWEAR
product
However, if I then enter:
mydomain.com/hum_images.php?hub_section=product&hub_subsection1=APPAREL
function selectHubImages ($hub_section, $hub_subsection1) {
global $db;
$result = mysql_db_query ($db, "SELECT navigations.nav_label, navigations.nav_parent, navigations.nav_name, navigations.nav_menu, product_items.product_section, product_items.product_parent, product_items.product_name, RAND() AS 'random' FROM product_items, navigations WHERE navigations.nav_name = product_items.product_name AND product_items.product_section = '$hub_section' AND product_items.product_parent = '$hub_subsection1' ORDER by random");
$n = 1;
echo "$hub_subsection1<br>"; // for debugging
echo "$hub_section<br>"; // for debugging
while ($row = mysql_fetch_object ($result) and $n <= 5) {
echo "thumb" . $n . "=" . $row->product_name . "&";
echo "thumb_subsection_two" . $n . "=" . $row->nav_parent . "&";
echo "thumb_label" . $n . "=" . $row->nav_label . "&";
$n = $n + 1;
}
echo "thumb_vartot=" . ($n - 1);
echo "&done=1&backspace=";
mysql_free_result ($result);
}