Jump to content

PHPBB3 sql error (please be familiar with phpbb)


Guest

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'] . "'";

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.