Jump to content

Unexpected ' " ' in this code?


SteelyDan

Recommended Posts

Hey again, wondering if I can get some help with finding the error in my code here.

 

I'm creating a string to query my MySQL database with, and keep getting the following error:

 

Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\web\submit_build.php on line 56

<?php //submit_build.php

include_once 'header.php';
require_once 'login_builds.php';
include_once 'functions.php';

$db_server = mysql_connect($db_hostname, $db_username, $db_password);

mysql_select_db($db_database)
	or die("Unable to select database: " . mysql_error());

if (isset($_POST['buildname']) &&
	isset($_POST['weapon']) &&
	isset($_POST['mod1']) &&
	isset($_POST['mod2']) &&
	isset($_POST['mod3']) &&
	isset($_POST['mod4']) &&
	isset($_POST['mod5']) &&
	isset($_POST['mod6']) &&
	isset($_POST['mod7']) &&
	isset($_POST['mod8']) &&
	isset($_POST['polarity1']) &&
	isset($_POST['polarity2']) &&
	isset($_POST['polarity3']) &&
	isset($_POST['polarity4']) &&
	isset($_POST['polarity5']) &&
	isset($_POST['polarity6']) &&
	isset($_POST['polarity7']) &&
	isset($_POST['polarity8']) &&
	isset($_POST['description']) &&
	isset($_POST['password']))
{
$buildname = sanitizeString($_POST['buildname']);
$weapon = 	sanitizeString($_POST['weapon']);
$mod1 = 	sanitizeString($_POST['mod1']);
$mod2 = 	sanitizeString($_POST['mod2']);
$mod3 = 	sanitizeString($_POST['mod3']);
$mod4 = 	sanitizeString($_POST['mod4']);
$mod5 = 	sanitizeString($_POST['mod5']);
$mod6 = 	sanitizeString($_POST['mod6']);
$mod7 = 	sanitizeString($_POST['mod7']);
$mod8 = 	sanitizeString($_POST['mod8']);
$polarity1 =	sanitizeString($_POST['polarity1']);
$polarity2 =	sanitizeString($_POST['polarity2']);
$polarity3 =	sanitizeString($_POST['polarity3']);
$polarity4 =	sanitizeString($_POST['polarity4']);
$polarity5 =	sanitizeString($_POST['polarity5']);
$polarity6 =	sanitizeString($_POST['polarity6']);
$polarity7 =	sanitizeString($_POST['polarity7']);
$polarity8 =	sanitizeString($_POST['polarity8']);
$description =	sanitizeString($_POST['description']);

$pw_check = md5($_POST['password']);
if ($pw_check == $password)
{
$add_build = "INSERT INTO builds VALUES(NULL,'$username','$buildname','$weapon','mod1','mod2','mod3','mod4','mod5','mod6','mod7','mod8','polarity1','polarity2','polarity3','polarity4','polarity5','polarity6','polarity7','polarity8','$description',NULL,'$_SESSION['ipaddress']')";
mysql_query($add_build);
header("Location: account.php");
}
else{
die("Incorrect password.");
}
?>

Thanks a bunch!

 

Nick

Link to comment
https://forums.phpfreaks.com/topic/280577-unexpected-in-this-code/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.