SteelyDan Posted July 27, 2013 Share Posted July 27, 2013 (edited) 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 Edited July 27, 2013 by SteelyDan Quote Link to comment Share on other sites More sharing options...
Solution Barand Posted July 27, 2013 Solution Share Posted July 27, 2013 try using curly braces '{$_SESSION['ipaddress']}' Quote Link to comment Share on other sites More sharing options...
SteelyDan Posted July 27, 2013 Author Share Posted July 27, 2013 Genius, that did it! Gotta plow through a few more errors now, but that was one I never would have figured out. Thank you so much! Nick Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.