Cannot set friend-based options
|
04-02-2012 04:16 PM
|
|
Administrator, Lead Coder
|
|
Cannot set friend-based options
The error message 'Call to a member function fetchObject() on a non-object' is displayed when users try to set friend-based options
As was reported from Tale of Dragon forums, the current Mys v1.3.0 release has a glitch with the friends.php file. This error is generated when users attempt to set friend-based options:
PHP Code:
Fatal error: Call to a member function fetchObject() on a non-object in /home/taleofdr/public_html/friends.php on line 115
After taking a look into the friends.php, I found that the keyword 'AND' was missing from the query that retrieves database information for friends. This is not a problem for Mys v1.3.1 as the new database class' methods join() and select() takes care of sql queries. But now you see, it is a good idea to implement a database class in a way that it prevents errors in database queries.
|
|
Issue Details
|
Category Unknown
Status Fixed
Priority 6
Affected Version Mys v1.3.0
Fixed Version Mys v1.3.1
Users able to reproduce bug
0
Users unable to reproduce bug
0
Assigned Users
Hall of Famer
Tags
(none)
|
|
04-02-2012 04:18 PM
|
|
Administrator, Lead Coder
|
|
|
To fix this, find the long query string from friends.php file:
PHP Code:
$query = "SELECT * FROM {$prefix}users, {$prefix}users_options WHERE {$prefix}users.username='{$loggedinname}' {$prefix}users_options.uid = {$prefix}users.uid {$prefix}users_options.username = {$prefix}users.username";
And replace with:
PHP Code:
$query = "SELECT * FROM {$prefix}users, {$prefix}users_options WHERE {$prefix}users.username='{$loggedinname}' AND {$prefix}users_options.uid = {$prefix}users.uid AND {$prefix}users_options.username = {$prefix}users.username";
With the keyword 'AND' in the query, the PDO statement object should be successfully generated, thereby fixing the error.
|
All times are GMT -5. The time now is 07:38 PM.
Currently Active Users: 1783 (0 members and 1783 guests)
Threads: 4,081, Posts: 32,025, Members: 2,016
Welcome to our newest members,
jolob.