"Doesn't work" doesn't exactly paint a picture.
For one thing:
@ $db = mysql_pconnect("localhost", "my_login", "my_password");
if (!$db)
{
echo "Error: Could not connect to database. Please try again later.";
exit;
}
mysql_select_db("catalog");
Should be taken outside the $_COOKIE iteration loop, and can be more
cleanly written as
$db = @mysql_pconnect("localhost", "my_login", "my_password")
or die("Error: Could not connect to database. Please try again later");
mysql_select_db("catalog");
And you may even be able to get away with dropping the @.
Also, a faster way of doing the $COOKIE loop would be
foreach($_COOKIE as $cname=>$cavlue)