Seems Simple...Can't Figure It Out!

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
PHP_Ryan
Forum Newbie
Posts: 12
Joined: Fri Apr 09, 2004 8:05 pm

Seems Simple...Can't Figure It Out!

Post by PHP_Ryan »

Need some help...I have the following code to hopefully populate variables for a javascript array for a category/subcategory dependant select menu (Choose a category, subcategories get populated):
-----------------------------------------------------

Code: Select all

$sql = "SELECT DISTINCT cat, subcat, subcat_id FROM products ORDER BY cat, subcat"; 

$result = mysql_query($sql); 

$last_cat = ""; 
while ($row = mysql_fetch_array($result)) 
{ 
if ($rowї'cat'] !== $last_cat) 
{ 
echo ""{$rowї'cat']}*"\n"; 
$last_cat = $rowї'cat']; 
} 
echo ""results.php?tunedsearch={$rowї'subcat_id']}|{$rowї'subcat']}#" +\n"; 
}
-----------------------------------------------------
I cannot get the ouput to look like this:
-----------------------------------------------------

"Wheels & More*results.php?tunedsearch=aluminumwheels|Aluminum Wheels#" +
"results.php?tunedsearch=plasticwheels|Plastic Wheels#" +
"results.php?tunedsearch=dishwheels|Dish Wheels",
"Nitro Trucks*results.php?tunedsearch=stadiumtrucks|Stadium Trucks#" +
"results.php?tunedsearch=monstertrucks|Monster Trucks#"+
"results.php?tunedsearch=buggies|Buggies",

-----------------------------------------------------
My DB is set up in the following manor:
-----------------------------------------------------

columns: cat, subcat, subcat_id

example row: Wheels & More, Aluminum Wheels, aluminumwheels

-----------------------------------------------------

Any help would be greatly appreciated...thanks in advance,

Ryan
PHP_Ryan
Forum Newbie
Posts: 12
Joined: Fri Apr 09, 2004 8:05 pm

Post by PHP_Ryan »

Got it! Disregard the post...
Post Reply