bobbywise
09-30-2003, 09:08 AM
Hi,
I stumbled across an error while viewing favorites.php, and is due to the fact that the function it calls from style.php is not looking at the correct table in the database.
The following line is at fault in the function getUserLink($user) within style.php:
$sql = "SELECT user_name, isAgent, ID FROM UserDB WHERE (ID = $user)";
This is because all the database tables are prefixed by default_
So there are two ways to fix this line.
1. By adding default_ so it reads as follows:
$sql = "SELECT user_name, isAgent, ID FROM default_UserDB WHERE (ID = $user)";
2. By adding the actual configuration prefix, " . $config[table_prefix] . " so it reads as follows:
$sql = "SELECT user_name, isAgent, ID FROM " . $config[table_prefix] . "UserDB WHERE (ID = $user)";
Solution 1 works fine. But for some bizarre reason solution 2 still produces an SQL error similar to the following:
SELECT user_name, isAgent, ID FROM UserDB WHERE (ID = '6')
This means that for some reason in solution 2, the configuration prefix, " . $config[table_prefix] . " is being ignored. I am really confused as to why this is the case because the configuration prefix, " . $config[table_prefix] . " works fine in all of the other functions defined.
Any ideas ?
Rob.
http://www.robertwisbey.com
I stumbled across an error while viewing favorites.php, and is due to the fact that the function it calls from style.php is not looking at the correct table in the database.
The following line is at fault in the function getUserLink($user) within style.php:
$sql = "SELECT user_name, isAgent, ID FROM UserDB WHERE (ID = $user)";
This is because all the database tables are prefixed by default_
So there are two ways to fix this line.
1. By adding default_ so it reads as follows:
$sql = "SELECT user_name, isAgent, ID FROM default_UserDB WHERE (ID = $user)";
2. By adding the actual configuration prefix, " . $config[table_prefix] . " so it reads as follows:
$sql = "SELECT user_name, isAgent, ID FROM " . $config[table_prefix] . "UserDB WHERE (ID = $user)";
Solution 1 works fine. But for some bizarre reason solution 2 still produces an SQL error similar to the following:
SELECT user_name, isAgent, ID FROM UserDB WHERE (ID = '6')
This means that for some reason in solution 2, the configuration prefix, " . $config[table_prefix] . " is being ignored. I am really confused as to why this is the case because the configuration prefix, " . $config[table_prefix] . " works fine in all of the other functions defined.
Any ideas ?
Rob.
http://www.robertwisbey.com