Jump to content

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

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_param

Ive also just tested my connection and that seems fine too.

Its just not making sense.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.