Jump to content

Recommended Posts

I'm having trouble with a mysql query. Specifically, I am looping through some queries, and I have a variable variable inside the query which I'm sure is causing the problem. Actually there are two variable variables.

 

Right now the error is:

Parse error: syntax error, unexpected '{', expecting ']' in C:\wamp\www\loginTest\status.inc.php on line 200

 

Here is the query:

mysqli_query($db , "UPDATE `{$type}s` SET login_hold = 0 WHERE " . $type . "_id = '{$row[{"$type" . "_id"}]}' LIMIT 1");

 

I know I'd eventually get it, but some help is appreciated.

That's what I had to do. It's weird that I could do something like this:

 

<?php
$type= "user";
$row['user_id'] = 13874;
$query = "UPDATE `{$type}s` SET login_hold = 0 WHERE " . $type . "_id = '" . $row[$type . _id] . "' LIMIT 1";
echo $query;
?>

 

but when the query is actually inserted into mysqli_query, it doesn't work anymore.

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.