submitrating.php:
index.php (where rate drop down box displays at
rate.php:
I am trying to get the rating to write to the database according to the game that is being rated, this needs a little more coding to make it write to the correct game.
Can someone help please?
here is the url:
www.getgamereviews.com if you click on a game title you will see where the drop down box displays.
Code:
<?
if($_POST['submit'])
{
include("config.php");
$rating = mysql_real_escape_string($_POST['rating']);
$result=MYSQL_QUERY("INSERT INTO gamepage (rating)".
"VALUES ('$rating')");
echo "Query Finished";
Header ("Location: ./rate.php");
}
?>
index.php (where rate drop down box displays at
Code:
include "rate.php";
Code:
<?
include "config.php";
if (is_numeric($_GET['id']))
{
$id = $_GET['id'];
$result = mysql_query("SELECT platform,description,id,title,release_us,msrp,buylink,developer,publisher,esrb,genre,boxart FROM `gamepage` where id = $id") or die(mysql_error
());
while ($row = mysql_fetch_array($result))
{
$title = $row["title"];
$description = $row["description"];
$cat = $row['platform'];
$release_us = $row['release_us'];
$boxart = $row['boxart'];
$msrp = $row['msrp'];
$buylink = $row['buylink'];
$developer = $row['developer'];
$publisher = $row['publisher'];
$esrb = $row['esrb'];
$genre = $row['genre'];
echo ("<p>$title</p>");
echo ("<p>$cat");
echo "<p><img src='$boxart'></p>";
echo stripcslashes ("<p>$description</p>");
echo ("<p>$release_us</p>");
echo ("<p>$msrp</p>");
echo "<p><a href='$buylink'>Buy Now</a></p>";
echo ("<p>$developer</p>");
echo ("<p>$publisher</p>");
echo ("<p>$esrb</p>");
echo ("<p>$genre</p>");
[COLOR=Red]include "rate.php";[/COLOR]
}
echo nl2br("<p><a href='" . $_SERVER['SCRIPT_NAME'] . "'>Back</a></p>");
} else
{
$result = mysql_query("SELECT id,title FROM `gamepage` ORDER BY title") or die(mysql_error());
while ($row = mysql_fetch_array($result))
{
$title = $row["title"];
$id = $row["id"];
echo "<p><a href='index.php?id=$id'>$title</a></p>";
}
}
?>
rate.php:
Code:
<?
include("config.php");
?>
<html>
<form method="post" action="submitrating.php">
<h3>Rate Game:</h3>
<select name="rating">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
<br>
<br>
<INPUT TYPE="submit" name="submit" value="submit">
</form>
</html>
I am trying to get the rating to write to the database according to the game that is being rated, this needs a little more coding to make it write to the correct game.
Code:
$rating = mysql_real_escape_string($_POST['rating']);
$result=MYSQL_QUERY("INSERT INTO gamepage (rating)".
"VALUES ('$rating')");
Can someone help please?
here is the url:
www.getgamereviews.com if you click on a game title you will see where the drop down box displays.
Last edited:







