Parse error: syntax error, unexpected T_ELSE in /home/fallenpeopleadmin/keepingitkinky.net/review/verify_book.php on line 61
I can't seem to find any short/extra "{" brackets. I have been looking at the code for the past few days and still haven't found the error. I think I've been looking at it too long and need some fresh eyes.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
<title>Kinky - Add Book Review</title>
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="MSSmartTagsPreventParsing" content="true" />
<meta name="description" content="Adding a book review" />
<meta name="keywords" content="" />
<meta name="author" content="" />
<style type="text/css" media="all">@import "../css/style.css";</style> <style type="text/css" media="all">@import "../css/style.css";</style>
<?php
require_once('recaptchalib.php');
$privatekey = "my_key";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else {
//Include database connection details
include('config.php');
//Connect to mysql server
$mysql = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
if(!$mysql) {
die('Failed to connect to server: ' . mysql_error());
}
mysql_select_db("my_database", $mysql) or die( "Unable to select database" . mysql_error());
}
// Add new book review
$category_array = $_POST['category'];
foreach ($category_array as $one_category) {
$source .= $one_category.", ";
}
$category = substr($source, 0, -2);
if (!empty($_POST['question']))
{ //make sure input exists
$i=0;
$j=0;
for($i < count($_POST['question']); $j++;)/>
{ //removes questions with score of '0'
$score = array_sum($_POST['question']) / ($j * 5); //generates percentage
$score1 = ($score * 100) / 20; //turns percentage into score out of 5
$star = number_format($score1, 1);
}
else {
$star = 0;
}
}
$insListing_sql = "INSERT INTO book (id, image, rater_name, rate_date, title, author_last, author_first, star, publish_date, publisher, isbn, back_summary, rater_summary, rater_comments, category, buy) VALUES( '',
'".mysql_real_escape_string($_POST["image"])."',
'".mysql_real_escape_string($_POST["rater_name"])."',
'".mysql_real_escape_string($_POST["rate_date"])."',
'".mysql_real_escape_string($_POST["title"])."',
'".mysql_real_escape_string($_POST["author_last"])."',
'".mysql_real_escape_string($_POST["author_first"])."',
'".mysql_real_escape_string("$star")."',
'".mysql_real_escape_string($_POST["publish_date"])."',
'".mysql_real_escape_string($_POST["publisher"])."',
'".mysql_real_escape_string($_POST["isbn"])."',
'".mysql_real_escape_string($_POST["back_summary"])."',
'".mysql_real_escape_string($_POST["rater_summary"])."',
'".mysql_real_escape_string($_POST["rater_comments"])."',
'".mysql_real_escape_string("$category")."',
'".mysql_real_escape_string($_POST["buy"])."'
)";
$insListing_res = mysql_query($insListing_sql, $mysql)
or die(mysql_error($mysql));
?>
<table width=70%><tr><td>
<center><h1>Book Review Added!</h1><p>
<a class="ex1" href="book_add.php">Add Another Book Review</a><p>
<?php
echo "$quest, $score $score1, $star";
?>

New Topic/Question
Reply



MultiQuote






|