I am receiving a 'could not query' error when I try to use this function. Here is the code. If anyone could lend insight I would be appreciative!
<?php
$hostname = "localhost";
$db_name = "vladimirkush_com";
$user_name = "vladimir";
$pass = "vladimir";
$connection = @mysql_pconnect($hostname, $user_name, $pass) or die("Couldn't Connect!");
$db = @mysql_select_db($db_name, $connection) or die("Couldn't select database!");
//select art from category
function myList($cat){
$sql = "SELECT art_id, art_name
FROM Art
WHERE category_id = $cat
ORDER BY art_name
";
$result = @mysql_query($sql,$connection) or die("Couldn't execute this damn query.");
$category_list = "<ul>";
while ($row = mysql_fetch_array($result)) {
$art_id = $row['art_id'];
$art_name = $row['art_name'];
$category_list .= "<li><a href=\"viewer.php?art_id=$art_id&category_id=$category_id\">$art_name</a>";
}
$category_list .= "</ul>";
echo "$category_list";
}
?>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<? echo myList(8); ?>
</body>