Jump to content

Recommended Posts

I've tried the PHPBB help forum and no one has answered.  :shrug: I thought i'd try here.

 

For some reason i'm getting this weird error when I attempt to post.

 

SQL ERROR [ mysqli ]

 

Unknown column 'Tony' in 'where clause' [1054]

 

SQL

 

UPDATE phpbb_users SET user_gold = 50 WHERE username =Tony

 

 

Tony is in the username row. What am I doing wrong? here's the code I'm using.

if (($mode == 'reply' || $mode == 'quote' || $mode == 'post'))
{
$sql = "UPDATE phpbb_users SET user_gold = 50 WHERE username =" .  $user->data['username'] . "";
$db->sql_query($sql);
}

I've tried the PHPBB help forum and no one has answered.

 

Probably because the error has nothing to do with phpbb. It's a basic sql question.

 

String data in a query must be enclosed by single quotes. Without the single-quotes, the query is treating the username as a column name.

 

$sql = "UPDATE phpbb_users SET user_gold = 50 WHERE username ='" .  $user->data['username'] . "'";

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.