wright67uk Posted August 22, 2013 Share Posted August 22, 2013 Im getting " Parse error: syntax error, unexpected T_VARIABLE on line 17" (//stop here) after making a few changes to my file. I've checked the GET variables, and I've checked my database field Types. Ive echoed $placed, and $id. (all fine). Where am I going wrong? and what is causing the Parse error? <?php session_start(); $user_id = $_SESSION["user"]["user_id"]; $user_level = $_SESSION["user"]["user_level"]; include 'connect.php'; $outcome = $_GET['outcome']; $id = $_GET['id']; $blank = " "; $placed = $_GET['outcome']; if (isset($placed)) { $stmt = $mysqli->prepare("UPDATE toptips SET placed = ? WHERE id = ? "); $stmt->bind_param('si', $placed, $id); //stops here $stmt->execute(); $stmt->close(); } if ($outcome == "undo") { $stmt = $mysqli->prepare("UPDATE toptips SET placed = ?, win = ? WHERE id = ? "); $stmt->bind_param('ssi', $blank, $blank, $id); $stmt->execute(); $stmt->close(); } Quote Link to comment https://forums.phpfreaks.com/topic/281480-t_variable-parse-error-mysqli-prepared-statement/ Share on other sites More sharing options...
jazzman1 Posted August 22, 2013 Share Posted August 22, 2013 Sounds like, you may be run into a different file. What happens if you comment all lines of the script. Something like: <?php /*session_start(); $user_id = $_SESSION["user"]["user_id"]; $user_level = $_SESSION["user"]["user_level"]; include 'connect.php'; $outcome = $_GET['outcome']; $id = $_GET['id']; $blank = " "; $placed = $_GET['outcome']; if (isset($placed)) { $stmt = $mysqli->prepare("UPDATE toptips SET placed = ? WHERE id = ? "); $stmt->bind_param('si', $placed, $id); //stops here $stmt->execute(); $stmt->close(); } * */ Quote Link to comment https://forums.phpfreaks.com/topic/281480-t_variable-parse-error-mysqli-prepared-statement/#findComment-1446399 Share on other sites More sharing options...
wright67uk Posted August 23, 2013 Author Share Posted August 23, 2013 Then I just get a blank page.I've even assigned values manually to the variables, and I still get get the same error on that $stmt->bind_paramIve also just tested my connection and that seems fine too.Its just not making sense. Quote Link to comment https://forums.phpfreaks.com/topic/281480-t_variable-parse-error-mysqli-prepared-statement/#findComment-1446423 Share on other sites More sharing options...
kicken Posted August 23, 2013 Share Posted August 23, 2013 Delete that line, and maybe the line before it, and re-type it. Do not just copy/paste. You may have a hidden/invalid character in there which is not being displayed in your editor, or here on the forums. Quote Link to comment https://forums.phpfreaks.com/topic/281480-t_variable-parse-error-mysqli-prepared-statement/#findComment-1446424 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.