keukapeteb
Newbie
Karma: 0
Posts: 6
|
 |
« on: May 08, 2007, 08:56:35 AM » |
|
Hi there,
phpScheduleIt has been up and working okay for a few days now, but someone just mentioned that when they try to configure a group, they get this error message:
There was an error executing your query: DB Error: no such table SELECT g.groupid, g.group_name, u.fname, u.lname, cnt.user_count FROM ets1_groups g LEFT JOIN ets1_user_groups ug ON g.groupid = ug.groupid AND ug.is_admin = 1 LEFT JOIN ets1_login u ON ug.memberid = u.memberid LEFT JOIN ( SELECT ug.groupid, COUNT(ug.memberid) as user_count FROM user_groups ug GROUP BY ug.groupid ) cnt ON cnt.groupid = g.groupid ORDER BY group_name LIMIT 0, 25 [nativecode=1146 ** Table 'edt_schedule.user_groups' doesn't exist]
At first glance, it looks to me that it's not adding the table prefix to the FROM table. Does anyone know where I'd be able to go in and repair this?
|
|
|
|
|
Logged
|
|
|
|
Nick
Administrator
Hero Member
   
Karma: 15
Posts: 5419
|
 |
« Reply #1 on: May 09, 2007, 09:57:36 AM » |
|
The bug fix for this is to change lines 862-868 to: $query = 'SELECT g.groupid, g.group_name, u.fname, u.lname, cnt.user_count FROM ' . $this->get_table(TBL_GROUPS) . ' g LEFT JOIN ' . $this->get_table(TBL_USER_GROUPS) . ' ug ON g.groupid = ug.groupid AND ug.is_admin = 1 LEFT JOIN ' . $this->get_table(TBL_LOGIN) . ' u ON ug.memberid = u.memberid LEFT JOIN ( SELECT ug.groupid, COUNT(ug.memberid) as user_count FROM ' . $this->get_table(TBL_USER_GROUPS) . ' ug GROUP BY ug.groupid) cnt ON cnt.groupid = g.groupid ORDER BY group_name';
|
|
|
|
|
Logged
|
|
|
|
keukapeteb
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #2 on: May 09, 2007, 01:28:15 PM » |
|
The bug fix for this is to change lines 862-868 to: $query = 'SELECT g.groupid, g.group_name, u.fname, u.lname, cnt.user_count FROM ' . $this->get_table(TBL_GROUPS) . ' g LEFT JOIN ' . $this->get_table(TBL_USER_GROUPS) . ' ug ON g.groupid = ug.groupid AND ug.is_admin = 1 LEFT JOIN ' . $this->get_table(TBL_LOGIN) . ' u ON ug.memberid = u.memberid LEFT JOIN ( SELECT ug.groupid, COUNT(ug.memberid) as user_count FROM ' . $this->get_table(TBL_USER_GROUPS) . ' ug GROUP BY ug.groupid) cnt ON cnt.groupid = g.groupid ORDER BY group_name';
Hi Nick -- Thanks for the fix. My only question now is ... lines 862-868 in which file? 
|
|
|
|
|
Logged
|
|
|
|
Nick
Administrator
Hero Member
   
Karma: 15
Posts: 5419
|
 |
« Reply #3 on: May 10, 2007, 09:43:44 AM » |
|
My apologies, I keep for getting file names lately. Anyway, its in lib/db/AdminDB.class.php.
|
|
|
|
|
Logged
|
|
|
|
baldomax
Newbie
Karma: 0
Posts: 2
|
 |
« Reply #4 on: May 31, 2007, 07:05:41 AM » |
|
The bug fix for this is to change lines 862-868 to: $query = 'SELECT g.groupid, g.group_name, u.fname, u.lname, cnt.user_count FROM ' . $this->get_table(TBL_GROUPS) . ' g LEFT JOIN ' . $this->get_table(TBL_USER_GROUPS) . ' ug ON g.groupid = ug.groupid AND ug.is_admin = 1 LEFT JOIN ' . $this->get_table(TBL_LOGIN) . ' u ON ug.memberid = u.memberid LEFT JOIN ( SELECT ug.groupid, COUNT(ug.memberid) as user_count FROM ' . $this->get_table(TBL_USER_GROUPS) . ' ug GROUP BY ug.groupid) cnt ON cnt.groupid = g.groupid ORDER BY group_name';
Hi Nick -- Thanks for the fix. My only question now is ... lines 862-868 in which file?  I've installed this fix but..... C'è stato un errore eseguendo questa interrogazione: DB Error: syntax error SELECT g.groupid, g.group_name, u.fname, u.lname, cnt.user_count FROM groups g LEFT JOIN user_groups ug ON g.groupid = ug.groupid AND ug.is_admin = 1 LEFT JOIN login u ON ug.memberid = u.memberid LEFT JOIN ( SELECT ug.groupid, COUNT(ug.memberid) as user_count FROM user_groups ug GROUP BY ug.groupid) cnt ON cnt.groupid = g.groupid ORDER BY group_name LIMIT 0, 25 [nativecode=1064 ** You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT ug.groupid, COUNT(ug.memberid) as user_count FROM user_g] :cry:
|
|
|
|
|
Logged
|
|
|
|
Nick
Administrator
Hero Member
   
Karma: 15
Posts: 5419
|
 |
« Reply #5 on: May 31, 2007, 02:20:00 PM » |
|
What version of MySQL is this? It may not support sub-selects.
|
|
|
|
|
Logged
|
|
|
|
alattke
Newbie
Karma: 0
Posts: 4
|
 |
« Reply #6 on: June 05, 2007, 11:31:37 PM » |
|
Hi Nick,
I get:
SELECT g.groupid, g.group_name, u.fname, u.lname, cnt.user_count FROM groups g LEFT JOIN user_groups ug ON g.groupid = ug.groupid AND ug.is_admin = 1 LEFT JOIN login u ON ug.memberid = u.memberid LEFT JOIN ( SELECT ug.groupid, COUNT(ug.memberid) as user_count FROM user_groups ug GROUP BY ug.groupid ) cnt ON cnt.groupid = g.groupid ORDER BY group_name LIMIT 0, 25 [nativecode=1064 ** You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ' SELECT ug.groupid, COUNT(ug.memberid) as user_count FROM user_g]
I am using MySQL server version 4.0.27 and Client version 4.1.10. I don't think that MySQL 4 handles sub-queries... Can you help me re-write this query so it works with MySQL 4.0 ?
BTW - You have a fantastic piece of code here... I love it!
Thank you for this awesome contribution to the open source community!
|
|
|
|
|
Logged
|
|
|
|
Nick
Administrator
Hero Member
   
Karma: 15
Posts: 5419
|
 |
« Reply #7 on: June 06, 2007, 09:02:57 AM » |
|
If you dont care about getting the count of users in the group, then all you would need is this in lines 862-868 in lib/db/AdminDB.class.php:
$query = 'SELECT g.groupid, g.group_name, u.fname, u.lname, 0 as user_count FROM ' . $this->get_table(TBL_GROUPS) . ' g LEFT JOIN ' . $this->get_table(TBL_USER_GROUPS) . ' ug ON g.groupid = ug.groupid AND ug.is_admin = 1 LEFT JOIN ' . $this->get_table(TBL_LOGIN) . ' u ON ug.memberid = u.memberid ORDER BY group_name';
|
|
|
|
|
Logged
|
|
|
|
alattke
Newbie
Karma: 0
Posts: 4
|
 |
« Reply #8 on: June 06, 2007, 09:51:30 PM » |
|
Thanks, Nick!
That fix worked great.
|
|
|
|
|
Logged
|
|
|
|
baldomax
Newbie
Karma: 0
Posts: 2
|
 |
« Reply #9 on: June 07, 2007, 07:11:19 AM » |
|
Thanks, Nick!
That fix worked great. Also for me! Thanks a lot Nick! 
|
|
|
|
|
Logged
|
|
|
|
|