SQL syntax error when trying to enter forums [message #29379] |
Fri, 16 December 2005 13:55 ![Go to next message Go to next message](/forum/theme/default/images/down.png) |
sommer
![Denmark Denmark](/forum/images/flags/dk.png) 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 #29395 is a reply to message #29388] |
Sat, 17 December 2005 16:41 ![Go to previous message Go to previous message](/forum/theme/default/images/up.png) ![Go to next message Go to next message](/forum/theme/default/images/down.png) |
sommer
![Denmark Denmark](/forum/images/flags/dk.png) 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 message Go to previous message](/forum/theme/default/images/up.png) ![Go to next message Go to next message](/forum/theme/default/images/down.png) |
Ilia
![Canada Canada](/forum/images/flags/ca.png) 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 message Go to previous message](/forum/theme/default/images/up.png) ![Go to next message Go to next message](/forum/theme/default/images/down.png) |
sommer
![Denmark Denmark](/forum/images/flags/dk.png) 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 #29405 is a reply to message #29404] |
Sun, 18 December 2005 16:17 ![Go to previous message Go to previous message](/forum/theme/default/images/up.png) ![Go to next message Go to next message](/forum/theme/default/images/down.png) |
sommer
![Denmark Denmark](/forum/images/flags/dk.png) 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 #29421 is a reply to message #29416] |
Mon, 19 December 2005 23:18 ![Go to previous message Go to previous message](/forum/theme/default/images/up.png) ![Go to next message Go to next message](/forum/theme/default/images/down.png) |
sommer
![Denmark Denmark](/forum/images/flags/dk.png) 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 #30759 is a reply to message #30293] |
Sun, 12 March 2006 21:34 ![Go to previous message Go to previous message](/forum/theme/default/images/up.png) ![Go to next message Go to next message](/forum/theme/default/images/down.png) |
paulbau
![Germany Germany](/forum/images/flags/de.png) 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 #35540 is a reply to message #29379] |
Sat, 20 January 2007 00:27 ![Go to previous message Go to previous message](/forum/theme/default/images/up.png) |
kalmarek
![Poland Poland](/forum/images/flags/pl.png) 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
|
|
|