$db=mysql_pconnect ("localhost", "parismav_guest", "GuestPass333") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db("parismav_huilingDB");
$cat = stripslashes($_GET['cat']);
$id = stripslashes($_GET['id']);
if (($cat == '')||($id==''))
{
$cat = "abstract";
$id=="AB00";
}
//$query = "select * from HLartworks where type=$cat order by year desc;";
//echo ($cat);
//if (($cat!="'abstract'")&&($cat!="'cards'")&&($cat!="'classical'")&&($cat!="'portrait'")&&($cat!="'still'")&&($cat!="'landscape'"))
//die('invalid url!');
$query = "select * from HLartworks where type='$cat' order by year desc";
//$query = "select * from HLartworks where id=$id";
$result = mysql_query($query);
$num_results = mysql_num_rows($result);
$targetInd = NULL;
for ($i=0; $i<$num_results; $i++)
{
$piece[$i] = mysql_fetch_array($result);
if ($piece[$i]['id']==$id)
{
$targetInd=$i;
}
}
if (($targetInd==NULL)||($targetInd>$num_results+1))
$targetInd=0;
?>