I am officially in a black hole. I am writing a user rating system script that is supposed to average out all the user ratings given to a certain row. Each of my rows has a field in it called 'rating'. I have a script that lloks like this:
Code: Select all
<?php
$db = mysql_connect("localhost","","");
mysql_select_db("dbthawowi_2",$db);;
$callsign = $HTTP_POST_VARSї'id'];
$callsign = $_GETї'id'];
$query = "SELECT * FROM userjokes WHERE id='$id'";
$resultat = mysql_query($query) or die(mysql_error());
$row= mysql_fetch_object($resultat);
echo "Joke number ";
print"$row->id<br><br>";
print"$row->text<br><br>";
echo "Joke submitted by: ";
print"$row->name ";
echo "on ";
print "$row->date<br>";
?>Code: Select all
<?php
$db = mysql_connect("localhost","","");
mysql_select_db("dbthawowi_2",$db);;
$callsign = $HTTP_POST_VARSї'id'];
$sql="SELECT id, joke FROM userjokes WHERE validation='yes' ORDER BY id";
$res=mysql_query($sql, $db);
while ($row = mysql_fetch_object ($res))
{
print "<td><a href="archive2.php?id=$row->id" target="new">" . $row->id . "</a>";
}
?>Now, I'm not asking for you people to write me a code. I'm asking you to point me in the right direction, give me an idea of how to start this. Please don't point me to the PHP manual, but something more specific. Thanks.