SMF Support > SMF 2.0.x Support

Sendpm problem

(1/2) > >>

CircleDock:
For no explicable reason, Sendpm (Subs-Post.php) is throwing an SQL-related error whenever anyone attempts to send a private message. The error shown is this:

The database value you're trying to insert does not exist: from_id

It's this query that triggers the problem:

--- Code: --- $request = $smcFunc['db_query']('', '
SELECT
member_name, real_name, id_member, email_address, lngfile,
pm_email_notify, instant_messages,' . (allowedTo('moderate_forum') ? ' 0' : '
(pm_receive_from = {int:admins_only}' . (empty($modSettings['enable_buddylist']) ? '' : ' OR
(pm_receive_from = {int:buddies_only} AND FIND_IN_SET({string:from_id}, buddy_list) = 0) OR
(pm_receive_from = {int:not_on_ignore_list} AND FIND_IN_SET({string:from_id}, pm_ignore_list) != 0)') . ')') . ' AS ignored,
FIND_IN_SET({string:from_id}, buddy_list) != 0 AS is_buddy, is_activated,
additional_groups, id_group, id_post_group
FROM {db_prefix}members
WHERE id_member IN ({array_int:recipients})
ORDER BY lngfile
LIMIT {int:count_recipients}',
array(
'not_on_ignore_list' => 1,
'buddies_only' => 2,
'admins_only' => 3,
'recipients' => $all_to,
'count_recipients' => count($all_to),
'from_id' => $from['id'],
)
);

--- End code ---

Anyone any idea why this should suddenly stop working? The version of MySQL installed is 5.1.63-cll if that helps.

emanuele:
What mods do you have installed?

CircleDock:
A mod to allow attachments in PMs is the only one that affects Subs-Post. I've tried uninstalling it but there's no difference.

emanuele:

--- Quote from: emanuele on July 10, 2012, 12:25:11 PM ---What mods do you have installed?

--- End quote ---

CircleDock:
Emanuele, did you read the error message? The error is being thrown by MySQL - the error line given in the error log is that for the ");" which ends that query. There is a mod installed but it doesn't affect the SQL query which - and I've checked - is in its original state. It is entirely possible that our host (we're on a HostGator virtual server) may have "updated" MySQL.

The error message itself is confusing: "The database value you're trying to insert does not exist: from_id", because the query is a SELECT which, as far as I know, doesn't insert values into a database table. "from_id" is defined in that query as $from['id'] - which in turn is previously initialised to be $user_info['id'].

As an adjunct problem, there is a "back" link provided on the error "panel" to re-display the PM form. If the user attempts to re-submit the form, he will get a different error which tells him that he has already submitted that message. He therefore thinks his PM has been sent, but of course it hasn't.

Navigation

[0] Message Index

[#] Next page

Go to full version