Jump to content

T_variable parse error - mysqli prepared statement


wright67uk

Recommended Posts

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(); 
}

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(); 
}
 * 
 */

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.