Code: Select all
<?php
function already_rated($nom)
{
global $sDB,$nConnection,$sTableRatings;
$cmd="select * from $sTableRatings where pic_name='".addslashes($nom)."' and ip='".getenv("REMOTE_ADDR")."'";
$res=mysql_db_query($sDB,$cmd,$nConnection);
$row=mysql_fetch_array($res);
return($row);
}
?>Code: Select all
<?phpfunction get_rating($nom)
{
global $sDB,$nConnection,$sTableRatings;
$cmd="select avg(rating), count(*) from $sTableRatings where pic_name='".addslashes($nom)."'";
$res=mysql_db_query($sDB,$cmd,$nConnection);
$row=mysql_fetch_array($res);
return ($row[1]?$row[0]:false);
}
?>This may not be enough information and if not I would be happy to offer more, along with the URL where this is set up. Any suggestions on where to start looking to resolve this issue would be greatly appreciated.
Cheers!