FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » General » FUDforum in eGroupWare » SQL syntax error when trying to enter forums
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
SQL syntax error when trying to enter forums [message #29379] Fri, 16 December 2005 13:55 Go to next message
sommer is currently offline  sommer   Denmark
Messages: 21
Registered: December 2005
Location: Denmark
Karma: 0
Junior Member
Hi!

I have recently installed the egroupware system including fudforum 2.6.0. The installation worked fine, egroupware works fine and administration of fudforum works fine. I have created a number of categories and some forums for each categori.

Unfortunately I get an error when trying to enter any one of my forums!

URL:
www_root/egroupware/fudforum/3814588639/index.php?t=thread&frm_id=3& ;

Typical error-message:
(/Library/WebServer/Documents/egroupware/fudforum/3814588639/index.php:131
/Library/WebServer/Documents/egroupware/fudforum/3814588639/theme/default/t hread.php:305
/Library/WebServer/Documents/egroupware/fudforum/3814588639/theme/default/t hread.php:328
/Library/WebServer/Documents/egroupware/fudforum/3814588639/index.php:414
) 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 'reads FROM phpgw_fud_fc_view v INNER JOIN phpgw_fud_forum f ON f.id=v.f ' at line 1
Query: SELECT f.id, f.name, c.name, c.id, CASE WHEN 0 < m.post_stamp AND (fr.last_view IS NULL OR m.post_stamp > fr.last_view) THEN 1 ELSE 0 END AS reads FROM phpgw_fud_fc_view v INNER JOIN phpgw_fud_forum f ON f.id=v.f INNER JOIN phpgw_fud_cat c ON c.id=v.c LEFT JOIN phpgw_fud_msg m ON m.id=f.last_post_id LEFT JOIN phpgw_fud_forum_read fr ON fr.forum_id=f.id AND fr.user_id=2 ORDER BY v.id
Server Version: 5.0.16-standard
[Referring Page] http://localhost/egroupware/fudforum/3814588639/index.php?


Does anyone know how to solve this problem?


On the same server I have installed a standalone version of FUDforum (ver. 2.7.3) that works fine. Is there a way to migrate this into my egroupware FUDforum?

My server configuration is:
mac os x 10.4
apache 1.3.33
php5
mysql 5
egroupware 1.2.001RC4
fudforum 2.6.0



Thanks,
Henrik
Re: SQL syntax error when trying to enter forums [message #29388 is a reply to message #29379] Fri, 16 December 2005 20:43 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Does the query work if you put the entire CASE ... END block inside braces?

FUDforum Core Developer
Re: SQL syntax error when trying to enter forums [message #29395 is a reply to message #29388] Sat, 17 December 2005 16:41 Go to previous messageGo to next message
sommer is currently offline  sommer   Denmark
Messages: 21
Registered: December 2005
Location: Denmark
Karma: 0
Junior Member
Hello Ilia

Thank you for your quick reply!

I am not quite sure what you mean by:

Ilia wrote on Fri, 16 December 2005 21:43

Does the query work if you put the entire CASE ... END block inside braces?


...but I suppose you want me to run the SELECT query modified like this:

SELECT f.id, f.name, c.name, c.id,
CASE WHEN {0 < m.post_stamp
AND (
fr.last_view IS NULL
OR m.post_stamp > fr.last_view
)
THEN 1
ELSE 0
END AS reads}
FROM phpgw_fud_fc_view v...


So I've thied that using phpMyAdmin 2.7.0-pl1, which gives me this error:

Error

SQL query: Documentation

SELECT f.id, f.name, c.name, c.id,
CASE WHEN {0 < m.post_stamp
AND (
fr.last_view IS NULL
OR m.post_stamp > fr.last_view
)
THEN 1
ELSE 0
END AS reads}
FROM phpgw_fud_fc_view v
INNER JOIN phpgw_fud_forum f ON f.id = v.f
INNER JOIN phpgw_fud_cat c ON c.id = v.c
LEFT JOIN phpgw_fud_msg m ON m.id = f.last_post_id
LEFT JOIN phpgw_fud_forum_read fr ON fr.forum_id = f.id
AND fr.user_id =2
ORDER BY v.id
LIMIT 0 , 30

MySQL said: Documentation
#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 '0 < m . post_stamp AND ( fr . last_view IS NULL OR m . post_stamp > fr . last_vi' at line 1


I hope this gives you some kind of clue to what might be wrong.

Thanks,
Henrik
Re: SQL syntax error when trying to enter forums [message #29400 is a reply to message #29395] Sun, 18 December 2005 14:13 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
I ment like this:
SELECT f.id, f.name, c.name, c.id, (CASE WHEN 0 < m.post_stamp AND (fr.last_view IS NULL OR m.post_stamp > fr.last_view) THEN 1 ELSE 0 END) AS reads FROM phpgw_fud_fc_view v INNER JOIN phpgw_fud_forum f ON f.id=v.f INNER JOIN phpgw_fud_cat c ON c.id=v.c LEFT JOIN phpgw_fud_msg m ON m.id=f.last_post_id LEFT JOIN phpgw_fud_forum_read fr ON fr.forum_id=f.id AND fr.user_id=2 ORDER BY v.id


FUDforum Core Developer
Re: SQL syntax error when trying to enter forums [message #29403 is a reply to message #29400] Sun, 18 December 2005 14:23 Go to previous messageGo to next message
sommer is currently offline  sommer   Denmark
Messages: 21
Registered: December 2005
Location: Denmark
Karma: 0
Junior Member
Ilia wrote on Sun, 18 December 2005 15:13

I ment like this:
SELECT f.id, f.name, c.name, c.id, (CASE WHEN 0 < m.post_stamp AND (fr.last_view IS NULL OR m.post_stamp > fr.last_view) THEN 1 ELSE 0 END) AS reads FROM phpgw_fud_fc_view v INNER JOIN phpgw_fud_forum f ON f.id=v.f INNER JOIN phpgw_fud_cat c ON c.id=v.c LEFT JOIN phpgw_fud_msg m ON m.id=f.last_post_id LEFT JOIN phpgw_fud_forum_read fr ON fr.forum_id=f.id AND fr.user_id=2 ORDER BY v.id


Oh - I see...


In that case I get this error-message:
Error

SQL query: Documentation

SELECT f.id, f.name, c.name, c.id, (

CASE WHEN 0 < m.post_stamp
AND (
fr.last_view IS NULL
OR m.post_stamp > fr.last_view
)
THEN 1
ELSE 0
END
) AS reads
FROM phpgw_fud_fc_view v
INNER JOIN phpgw_fud_forum f ON f.id = v.f
INNER JOIN phpgw_fud_cat c ON c.id = v.c
LEFT JOIN phpgw_fud_msg m ON m.id = f.last_post_id
LEFT JOIN phpgw_fud_forum_read fr ON fr.forum_id = f.id
AND fr.user_id =2
ORDER BY v.id
LIMIT 0 , 30

MySQL said: Documentation
#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 'reads FROM phpgw_fud_fc_view v INNER JOIN phpgw_fud_forum f ON f . id = v . f IN' at line 1



Very curious to see what you think about that.

/Henrik
Re: SQL syntax error when trying to enter forums [message #29404 is a reply to message #29403] Sun, 18 December 2005 14:30 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Try changing "reads" to another name, maybe on your system it is a reserved SQL keyword.

FUDforum Core Developer
Re: SQL syntax error when trying to enter forums [message #29405 is a reply to message #29404] Sun, 18 December 2005 16:17 Go to previous messageGo to next message
sommer is currently offline  sommer   Denmark
Messages: 21
Registered: December 2005
Location: Denmark
Karma: 0
Junior Member
Ilia wrote on Sun, 18 December 2005 15:30

Try changing "reads" to another name, maybe on your system it is a reserved SQL keyword.


That is very likely. If I replace "reads" with the danish equivalent "laesninger", then the query return an error-free result in phpMyAdmin:

id name name id laesninger
1 TestForum Test Category 1 0


One step closer, but how can I make my copy of FUDforum in eGW avoid using "reads" in the SQL query and is this going to have an affect on other parts of the FUDforum?

By the way, replacing the presumably reserved keyword "reads" with another word makes the braces () enclosing the CASE ... END block (mentioned earlier in this thread) obsolete.

/Henrik

[Updated on: Mon, 19 December 2005 21:10]

Report message to a moderator

Re: SQL syntax error when trying to enter forums [message #29416 is a reply to message #29405] Mon, 19 December 2005 16:45 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Edit thread_common.inc.t file and modify the query and then rebuild the theme.

FUDforum Core Developer
Re: SQL syntax error when trying to enter forums [message #29421 is a reply to message #29416] Mon, 19 December 2005 23:18 Go to previous messageGo to next message
sommer is currently offline  sommer   Denmark
Messages: 21
Registered: December 2005
Location: Denmark
Karma: 0
Junior Member
I have not been able to locate the thread_common.inc.t file you mentioned above and although there is a file named thread_view_common.inc.t I don't think this is the one you have in mind as it does not contain the query mentioned above.

However, I did make the FUDforum work by altering ../theme/default/thread.php and ../theme/default/msg.php, although I know this is not recommended.

msg.php and thread.php have been changed like this:
- $c = q('SELECT f.id, f.name, c.name, c.id, CASE WHEN '.$GLOBALS['usr']->last_read.' < m.post_stamp AND (fr.last_view IS NULL OR m.post_stamp > fr.last_view) THEN 1 ELSE 0 END AS reads

+ $c = q('SELECT f.id, f.name, c.name, c.id, CASE WHEN '.$GLOBALS['usr']->last_read.' < m.post_stamp AND (fr.last_view IS NULL OR m.post_stamp > fr.last_view) THEN 1 ELSE 0 END AS laesninger

These changes make the FUDforum work (at least I haven't found any errors yet), which made me think that the queries I needed to alter could be found in thread.php.t and msg.php.t recpectively, but that was not the case. Where can I find the right queries?

/Henrik


Re: SQL syntax error when trying to enter forums [message #29440 is a reply to message #29421] Wed, 21 December 2005 05:09 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
forumsel.inc.t is the file you need to edit.

FUDforum Core Developer
Re: SQL syntax error when trying to enter forums [message #30293 is a reply to message #29440] Wed, 15 February 2006 19:22 Go to previous messageGo to next message
paulbau is currently offline  paulbau   Germany
Messages: 3
Registered: February 2006
Karma: 0
Junior Member
Hello all!

i just want to confirm the bug / problem and its solution as described here.
I varied the "reads" (the only "reads" in the file forumsel.inc.t in eGWroot/fudfourm/setup/base/scr into something else.

i run all the service scripts in the fudforum?s administration-menu.
after that the forum works on my system:

on Apple OSX10.4.4
any browser

our EGW - Installation:
EGW 1.2 RC5
OSX 10.4.3
Xampp 0.5:
Apache 2.0
PHP Version 5.0.5
MySQL 5.0.15
Re: SQL syntax error when trying to enter forums [message #30759 is a reply to message #30293] Sun, 12 March 2006 21:34 Go to previous messageGo to next message
paulbau is currently offline  paulbau   Germany
Messages: 3
Registered: February 2006
Karma: 0
Junior Member
As i sad, i get the forum working.

but now, after updating to eGW 1.2RC-7.1 i get a error:

i also kopied the old folder 2624514858 into the new installation
and i also renamed the lines in forumsel.inc.t

we have this error:

Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0

Warning: Unknown: Failed opening '/Applications/xampp/htdocs/egw/fudforum/2624514858/index.php' for inclusion (include_path='.:/Applications/xampp/xamppfiles/lib/php') in Unknown on line 0

our EGW - Installation:
EGW 1.2 RC7-1
OSX 10.4.5
Xampp 0.5:
Apache 2.0
PHP Version 5.0.5
MySQL 5.0.15

[Updated on: Sun, 12 March 2006 21:54]

Report message to a moderator

Re: SQL syntax error when trying to enter forums [message #30760 is a reply to message #30759] Sun, 12 March 2006 21:57 Go to previous messageGo to next message
paulbau is currently offline  paulbau   Germany
Messages: 3
Registered: February 2006
Karma: 0
Junior Member
i found the solution:

i have to reset the acessrights for the fudforum folder and the index.php inside my forumfolder 321465746
Re: SQL syntax error when trying to enter forums [message #30857 is a reply to message #29379] Sat, 18 March 2006 09:25 Go to previous messageGo to next message
razvu is currently offline  razvu   United States
Messages: 8
Registered: March 2006
Karma: 0
Junior Member
HI!

I get exactly the same Mysql error after a fresh installation in Egroupware 1.2rc7. I have 5.x.
Where should I modify and what exactly?

Also, I have another installation and somehow the forum stopped working. I uninstalled it, then installed it again, it seemed ok, but then I cannot see any icons or options in EGW menus, not a link!
If I point the browser manually to .../fudforum, I get an access denied page!

Help is very much appreciated.

Thank you.
Re: SQL syntax error when trying to enter forums [message #32191 is a reply to message #29379] Tue, 13 June 2006 21:05 Go to previous messageGo to next message
Sir_Brizz is currently offline  Sir_Brizz   United States
Messages: 2
Registered: January 2005
Karma: 0
Junior Member
I got this same error on two different installations of eGW/FudForum. Isn't it time to bring the EGW sources up to date? Razz
Re: SQL syntax error when trying to enter forums [message #35540 is a reply to message #29379] Sat, 20 January 2007 00:27 Go to previous message
kalmarek is currently offline  kalmarek   Poland
Messages: 1
Registered: January 2007
Karma: 0
Junior Member
eGroupWare ver 1.2.105
MySQL: 5.0.22
Powered by: FUDforum 2.6.0 (FUDeGW)

forumsel.inc.t
-
38 : $c = q('SELECT f.id, f.name, c.name, c.id, CASE WHEN '.$GLOBALS['usr']->last_read.' < m.post_stamp AND (fr.last_view IS NULL OR m.post_stamp > fr.last_view) THEN 1 ELSE 0 END AS reads

+
38 : $c = q('SELECT f.id, f.name, c.name, c.id, CASE WHEN '.$GLOBALS['usr']->last_read.' < m.post_stamp AND (fr.last_view IS NULL OR m.post_stamp > fr.last_view) THEN 1 ELSE 0 END AS readsx

[Updated on: Sat, 20 January 2007 00:29]

Report message to a moderator

  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Error 404 in eGroupware
Next Topic: Migrating issues
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Dec 03 18:34:46 GMT 2024

Total time taken to generate the page: 0.02493 seconds