Hi to all I have rating and Hits problem in my child_list.php page.
In index page I am listing some children names, Visitor can select any children name they will get child details in child_list.php. In child_list.php I am showing child details and how many visitor hit the child page (Hits as count). and rating option i used in. when I select rate button in child_list.php I want to calculate rating only not calculate hits (hits only per visiting count) .
child_list.php code:
<?php
$id = addslashes(strip_tags($_GET['id']));
$host="localhost"; // Host name
$username="xxxx"; // Mysql username
$password="xxxx"; // Mysql password
$db_name="kids"; // Database name
$tbl_name="ca_kids"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect to server ");
mysql_select_db("$db_name")or die("cannot select DB");
$bname = addslashes(strip_tags($_GET['id']));
$sql=("SELECT * FROM $tbl_name WHERE bname = '".$id."'");
$result= mysql_query($sql);
$rows=mysql_fetch_array($result);
$count=$rows['count'];
$nov=$rows['nov'];
$rating=$rows['rating'];
$bname = mysql_escape_string($rows['bname']);
$fname = mysql_escape_string($rows['fname']);
$mname = mysql_escape_string($rows['mname']);
$age = mysql_escape_string($rows{'age'});
// if have no counter value set counter = 1
$result1=mysql_query($sql1);
//display chinld name and Hits
echo '<tr> </tr>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td colspan="2" class="secondtableheadtd" style="color: rgb(255, 255, 255);" align="center" background="../images/tab-bg.png" height="20"><font size="3" color="white">'.$rows['bname'].' || Hits:'.$rows['count'].'</font>
</td>
</tr>
</tbody>
</table>
';
//Display child image and information
echo'<table align="left" cellspacing="5" cellpadding="5" bgcolor="#ECF1EF" width="100%" border="0">
<tr><td rowspan=9 bgcolor="" align="left"><img src="http://localhost/polite/kids/images/' . $rows['image'] . '" alt="No Image" width="370" height="250" border="2px" bordercolor="white"></td></tr>
</table>
<table align="center" cellspacing="5" cellpadding="5" bgcolor="#ECF1EF" width="100%" border="0">
<tr>
<th colspan="2" bgcolor="#2F4F4F" align="left"><font size="2" color="white">Child Information</font></th>
</tr>
<tr><th align="left" width="90px" bgcolor="#FFFFFE">Child Name</th> <td>'.$bname.'</td></tr>
<tr><th align="left" width="90px" bgcolor="#FFFFFE">Father Name</th> <td>'.$fname.'</td></tr>
<tr><th align="left" width="90px" bgcolor="#FFFFFE">Mother Name</th> <td>'.$mname.'</td></tr>
<tr><th align="left" width="90px" bgcolor="#FFFFFE">Age</th> <td>'.$age.'</td></tr>
<table align="center" cellspacing="5" cellpadding="5" bgcolor="#ECF1EF" width="100%" border="0">
<tr>
<td bgcolor="#2F4F4F"><font size="3" color="white"><b>Rating For This Chaild</b></a></td></tr>
</table>
';
//Display Rating
echo '<table align="left" cellspacing="5" cellpadding="5" bgcolor="white" width="100%" border="0">
<tr><td>';
require "ratingck.php";
require "disp.php";
echo '<table align="center" cellspacing="5" cellpadding="5" bgcolor="#ECF1EF" width="100%" border="0">
<tr>
<td bgcolor="#2F4F4F"><font size="3" color="white"><b>Rate It</b></a></td></tr>
</table>
';
require "rating.php";
echo'
</td>
</tr>
</table>
';
// count more value (Hits count)
$addcounter=$count+1;
$sql2="update $tbl_name set count='$addcounter' WHERE bname = '".$id."'";
$result2=mysql_query($sql2);
mysql_close();
?>
any one help me here.