Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

T_variable parse error - mysqli prepared statement

$
0
0

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

Viewing all articles
Browse latest Browse all 13200

Trending Articles