Hi all,
I’m getting this lovely error, so helpful.
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in P:\xampplite\htdocs\ebooklist_v03\inc\addnew_process_test.php on line 53
$firstname = addslashes($_POST['firstname']);
$surname = addslashes($_POST['surname']);
$universeName = addslashes($_POST['universeName']);
$seriesname = addslashes($_POST['seriesname']);
$booktitle = addslashes($_POST['booktitle']);
$universenote = addslashes($_POST['universeNote']);
$seriesnote = addslashes($_POST['seriesNote']);
// $var = addslashes($_POST['']);
$universereadorder = $_POST['universereadorder'];
$yearpublished = $_POST['yearpublished'];
$readorder = $_POST['readorder'];
$read = $_POST['read'];
// $var = $_POST[''];
// Queries //
$select = mysql_query("SELECT authorID, firstname, surname FROM authors WHERE firstname='".$firstname."' AND surname='".$surname."'");
$ns = mysql_num_rows($select);
if( $ns == 1 ){ // If author already exists, get existing authorID before inserting book
$author = mysql_fetch_array($select);
$authorID = $author['authorID'];
if($seriesname != NULL){ // If series field is NOT null, create new series, 'yes' is the value of the field inSeries
$series_select = mysql_query("SELECT seriesID FROM series WHERE seriesName='".$seriesname."'");
$nss = mysql_num_rows($series_select);
if ($nss == 1){ // If series already exists, get existing seriesID before inserting book
$series = mysql_fetch_array($series_select);
$seriesID = $series['seriesID'];
if ($universeName != NULL){ // if series is in a universe, 'yes' in the inUniverse field
mysql_query("INSERT INTO books VALUES('', '".$authorID."', '".$booktitle."', ".$yearpublished.", '".$read."', 'yes', 'yes')");
$bookID = mysql_insert_id();
mysql_query("INSERT INTO series_books VALUES('', '".$seriesID."', '".$authorID."', '".$bookID."', '".$readorder."')");
}
else{
mysql_query("INSERT INTO books VALUES('', '".$authorID."', '".$booktitle."', ".$yearpublished.", '".$read."', 'yes', 'no')");
$bookID = mysql_insert_id();
mysql_query("INSERT INTO series_books VALUES('', '".$seriesID."', '".$authorID."', '".$bookID."', '".$readorder."')");
}
}
else{// create new series
if($universeName != NULL){
mysql_query("INSERT INTO books VALUES('', '".$authorID."', '".$booktitle."', ".$yearpublished.", '".$read."', 'yes', 'yes')");
$bookID = mysql_insert_id();
mysql_query("INSERT INTO universe VALUES('','".$universeName."','".$universenote."')");
$universeID = mysql_insert_id();
mysql_query("INSERT INTO series VALUES('', '".$seriesname."', '".$seriesnote."', '".$yearpublished."', 'yes')");
$seriesID = mysql_insert_id();
mysql_query("INSERT INTO series_universe VALUES('', '".$universeID."', '".$authorID."', '".$seriesID."', '".$universereadorder"')");
mysql_query("INSERT INTO series_books VALUES('', '".$seriesID."', '".$authorID."', '".$bookID."', '".$readorder."')");
}else{
mysql_query("INSERT INTO books VALUES('', '".$authorID."', '".$booktitle."', ".$yearpublished.", '".$read."', 'yes', 'no')");
$bookID = mysql_insert_id();
mysql_query("INSERT INTO series VALUES('', '".$seriesname."', '".$seriesnote."', '".$yearpublished."', 'no')");
$seriesID = mysql_insert_id();
mysql_query("INSERT INTO series_books VALUES('', '".$seriesID."', '".$authorID."', '".$bookID."', '".$readorder."');");
}
}
header('Location: ../index.php');
}
else{ // If series field is NULL 'no' is the value of the field inSeries and no new series is created
if($universeName != NULL){
mysql_query("INSERT INTO books VALUES('', '".$authorID."', '".$booktitle."', ".$yearpublished.", '".$read."', 'no', 'yes')");
$bookID = mysql_insert_id();
mysql_query("INSERT INTO universe VALUES('','".$universeName."','".$universenote."')");
$universeID = mysql_insert_id();
mysql_query("INSERT INTO book_universe VALUES('', '".$universeID."', '".$authorID."', '".$bookID."')");
header('Location: ../index.php');
}
else{
mysql_query("INSERT INTO books VALUES('', '".$authorID."', '".$booktitle."', ".$yearpublished.", '".$read."', 'no', 'no')");
header('Location: ../index.php');
}
}
}
else{
mysql_query("INSERT INTO authors VALUES('', '".$firstname."', '".$surname."');");
$authorID = mysql_insert_id();
if($seriesname != NULL){ // If series field is NOT null, create new series, 'yes' is the value of the field inSeries
$series_select = mysql_query("SELECT seriesID FROM series WHERE seriesName='".$seriesname."'");
$nss = mysql_num_rows($series_select);
if ($nss == 1){ // If series already exists, get existing seriesID before inserting book
$series = mysql_fetch_array($series_select);
$seriesID = $series['seriesID'];
if ($universeName != NULL){ // if series is in a universe, 'yes' in the inUniverse field
mysql_query("INSERT INTO books VALUES('', '".$authorID."', '".$booktitle."', ".$yearpublished.", '".$read."', 'yes', 'yes')");
$bookID = mysql_insert_id();
mysql_query("INSERT INTO series_books VALUES('', '".$seriesID."', '".$authorID."', '".$bookID."', '".$readorder."')");
}
else{
mysql_query("INSERT INTO books VALUES('', '".$authorID."', '".$booktitle."', ".$yearpublished.", '".$read."', 'yes', 'no')");
$bookID = mysql_insert_id();
mysql_query("INSERT INTO series_books VALUES('', '".$seriesID."', '".$authorID."', '".$bookID."', '".$readorder."')");
}
}
else{// create new series
if($universeName != NULL){
mysql_query("INSERT INTO books VALUES('', '".$authorID."', '".$booktitle."', ".$yearpublished.", '".$read."', 'yes', 'yes')");
$bookID = mysql_insert_id();
mysql_query("INSERT INTO universe VALUES('','".$universeName."','".$universenote."')");
$universeID = mysql_insert_id();
mysql_query("INSERT INTO series VALUES('', '".$seriesname."', '".$seriesnote."', '".$yearpublished."', 'yes')");
$seriesID = mysql_insert_id();
mysql_query("INSERT INTO series_universe VALUES('', '".$universeID."', '".$authorID."', '".$seriesID."', '".$universereadorder"')";
mysql_query("INSERT INTO series_books VALUES('', '".$seriesID."', '".$authorID."', '".$bookID."', '".$readorder."');");
}else{
mysql_query("INSERT INTO books VALUES('', '".$authorID."', '".$booktitle."', ".$yearpublished.", '".$read."', 'yes', 'no')");
$bookID = mysql_insert_id();
mysql_query("INSERT INTO series VALUES('', '".$seriesname."', '".$seriesnote."', '".$yearpublished."', 'no')");
$seriesID = mysql_insert_id();
mysql_query("INSERT INTO series_books VALUES('', '".$seriesID."', '".$authorID."', '".$bookID."', '".$readorder."');");
}
}
header('Location: ../index.php');
}
else{ // If series field is NULL 'no' is the value of the field inSeries and no new series is created
if($universeName != NULL){
mysql_query("INSERT INTO books VALUES('', '".$authorID."', '".$booktitle."', ".$yearpublished.", '".$read."', 'no', 'yes')");
$bookID = mysql_insert_id();
mysql_query("INSERT INTO universe VALUES('','".$universeName."','".$universenote."')");
$universeID = mysql_insert_id();
mysql_query("INSERT INTO book_universe VALUES('', '".$universeID."', '".$authorID."', '".$bookID."')");
header('Location: ../index.php');
}
else{
mysql_query("INSERT INTO books VALUES('', '".$authorID."', '".$booktitle."', ".$yearpublished.", '".$read."', 'no', 'no')");
header('Location: ../index.php');
}
}
}
?>
Sorry for the lengthy code, any help would be appreciated
Line 53 is this one by the way:
mysql_query("INSERT INTO series_universe VALUES('', '".$universeID."', '".$authorID."', '".$seriesID."', '".$universereadorder"')");