Click to See Complete Forum and Search --> : [RESOLVED] Parse Error


The Little Guy
03-30-2006, 05:22 PM
I can't figure this out what so ever, maybe someone here can help:

Parse error: parse error, unexpected $ in /home2/dtoporg/public_html/search/5.php on line 98

line 98 is on the bottom

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="robots" content="noindex,nofollow">
<link rel="stylesheet" type="text/css" href="style.css">
<title>Finder Vote</title>
</head>
<body>
<?php
$rate = $_GET["id"];

//connect to the database
mysql_connect("localhost","dtoporg_dtop","abc123"); //(host, username, password)

//specify database
mysql_select_db("dtoporg_search") or die("Unable to select database"); //select the database

//Build SQL Query
$query = "SELECT votes,v_rate,id,urltitle,url FROM search WHERE id=$rate";

$result = mysql_query($query);
if (!$result) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}
if (mysql_num_rows($result) == 0) {
echo "No rows found, nothing to print so am exiting";
exit;
}
if ($row = mysql_fetch_assoc($result)){

$id = $row["id"];
$rate = $row["v_rate"];
$votes = $row["votes"];
$urltitle = $row["urltitle"];
$url = $row["url"];


echo "
<table>
<tr>
<th colspan=\"2\">Current Status</th>
</tr>
<tr>
<td>Your Vote:</td><td>5</td>
</tr>
<tr>
<td>Site Title:</td><td>$urltitle</td>
</tr>
<tr>
<td>Site URL:</td><td>$url</td>
</tr>
<tr>
<td>ID Number:</td><td>$id</td>
</tr>
<tr>
<td>Old Vote Status:</td><td>$rate</td>
</tr>";

$newrate = ($rate + 5) / $votes;

echo "
<tr>
<td>New Vote Status:</td><td>$newrate</td>
</tr>";

$votes = $votes++;
$result = mysql_query("UPDATE search SET votes='$votes' v_rate='$newrate' WHERE id=$id");

echo "
<tr>
<td>Number Of Votes:</td><td>$votes</td>
</tr>";

if ($newrate <= 1 && $votes >= 5){
$sql = mysql_query("DELETE FROM search WHERE id=$id");

echo "
<tr>
<th colspan=\"2\">This entry will now be deleted</th>
<th colspan=\"2\">There are more than 100 votes, and it went under 1</th>
</tr>";

}else if ($newrate >= 1){

echo "
<tr>
<th colspan=\"2\">Thank You For your vote</th>
<th colspan=\"2\">Your Vote Has Been Acounted For</th>
</tr>";

}else{
echo "Sorry, your vote wasn't submitted<br><br>";
}
?>
</table>
</body>
</html>