SQL ERROR 1064 - MariaDB

Do not post support requests, bug reports or feature requests. Discuss phpBB here. Non-phpBB related discussion goes in General Discussion!
Scam Warning
Post Reply
User avatar
Anach
Registered User
Posts: 8
Joined: Thu May 29, 2003 2:29 am
Name: Scott

SQL ERROR 1064 - MariaDB

Post by Anach » Sat Mar 16, 2019 4:10 am

Hi everyone; I've got an error with my phpbb3.25 install after recently doing a dist-upgrade to Debian 10. I don't know my way around SQL enough to fix this sort of thing, but I do have full access to the server console and phpMyAdmin.

Any help for this error is greatly appreciated in advance.

Code: Select all

SQL ERROR [ mysqli ]

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') LEFT JOIN phpbb3_forums_track ft ON (ft.user_id = 4 AND ft.forum_id = f.forum_' at line 1 [1064]

SQL

SELECT f.*, ft.mark_time FROM (phpbb3_forums f) LEFT JOIN phpbb3_forums_track ft ON (ft.user_id = 4 AND ft.forum_id = f.forum_id) ORDER BY f.left_id

BACKTRACE

FILE: (not given by php)
LINE: (not given by php)
CALL: msg_handler()

FILE: [ROOT]/phpbb/db/driver/driver.php
LINE: 997
CALL: trigger_error()

FILE: [ROOT]/phpbb/db/driver/mysqli.php
LINE: 193
CALL: phpbb\db\driver\driver->sql_error()

FILE: [ROOT]/phpbb/db/driver/factory.php
LINE: 329
CALL: phpbb\db\driver\mysqli->sql_query()

FILE: [ROOT]/includes/functions_display.php
LINE: 150
CALL: phpbb\db\driver\factory->sql_query()

FILE: [ROOT]/index.php
LINE: 76
CALL: display_forums()

User avatar
battye
Extension Customisations
Extension Customisations
Posts: 10911
Joined: Wed Feb 11, 2004 11:02 am
Location: Australia
Contact:

Re: SQL ERROR 1064 - MariaDB

Post by battye » Sun Mar 17, 2019 3:35 am

I'm not really sure off the top of my head what the syntax error could be in MariaDB, but could you try this for me.

In phpMyAdmin, run this:

Code: Select all

SELECT f.*, ft.mark_time FROM (phpbb3_forums f) LEFT JOIN phpbb3_forums_track ft ON (ft.user_id = 4 AND ft.forum_id = f.forum_id) ORDER BY f.left_id
Presumably that will fail because it's the same as the query in the error you supplied.

Now try this:

Code: Select all

SELECT f.*, ft.mark_time FROM phpbb3_forums f LEFT JOIN phpbb3_forums_track ft ON (ft.user_id = 4 AND ft.forum_id = f.forum_id) ORDER BY f.left_id
Does that work?
Customisations Team Member

User avatar
Anach
Registered User
Posts: 8
Joined: Thu May 29, 2003 2:29 am
Name: Scott

Re: SQL ERROR 1064 - MariaDB

Post by Anach » Sun Mar 17, 2019 9:18 am

battye wrote:
Sun Mar 17, 2019 3:35 am
I'm not really sure off the top of my head what the syntax error could be in MariaDB, but could you try this for me.

In phpMyAdmin, run this:

Code: Select all

SELECT f.*, ft.mark_time FROM (phpbb3_forums f) LEFT JOIN phpbb3_forums_track ft ON (ft.user_id = 4 AND ft.forum_id = f.forum_id) ORDER BY f.left_id
Presumably that will fail because it's the same as the query in the error you supplied.

Now try this:

Code: Select all

SELECT f.*, ft.mark_time FROM phpbb3_forums f LEFT JOIN phpbb3_forums_track ft ON (ft.user_id = 4 AND ft.forum_id = f.forum_id) ORDER BY f.left_id
Does that work?
Thanks for the reply and sorry about the delay, I'm not getting notifications for some reason. That worked exactly as described. First query failed, second query passed.

User avatar
battye
Extension Customisations
Extension Customisations
Posts: 10911
Joined: Wed Feb 11, 2004 11:02 am
Location: Australia
Contact:

Re: SQL ERROR 1064 - MariaDB

Post by battye » Sun Mar 17, 2019 12:21 pm

Hmm, have you modified any code files manually before?

If you look at https://github.com/phpbb/phpbb/blob/335 ... hp#L50-L72 and particularly that first line where it says $sql_from = FORUMS_TABLE . ' f'; it doesn't appear to be putting brackets around the table name like it is with yours.

Can you compare that code block to yours in viewforum.php? If it's markedly different post the code snippet here and we'll figure it out. If it's very obvious (like there's circular brackets on that line in yours you can try removing it and seeing if it makes a difference).
Customisations Team Member

User avatar
Anach
Registered User
Posts: 8
Joined: Thu May 29, 2003 2:29 am
Name: Scott

Re: SQL ERROR 1064 - MariaDB

Post by Anach » Sun Mar 17, 2019 9:46 pm

battye wrote:
Sun Mar 17, 2019 12:21 pm
Hmm, have you modified any code files manually before?

If you look at https://github.com/phpbb/phpbb/blob/335 ... hp#L50-L72 and particularly that first line where it says $sql_from = FORUMS_TABLE . ' f'; it doesn't appear to be putting brackets around the table name like it is with yours.

Can you compare that code block to yours in viewforum.php? If it's markedly different post the code snippet here and we'll figure it out. If it's very obvious (like there's circular brackets on that line in yours you can try removing it and seeing if it makes a difference).
Ran a compare, and the code is identical./

After looking at that file, I thought I'd see what happens when I load that page. I realised I can load viewforum.php without error, and only get the error on index.php. I have been able to login to the admin/index.php.

Looks like the system has a few issues. I'm going to start fresh. I started having permission issues with things that were working fine the day before, so I suspect something else is going on now, and I'm going to start fresh on a new server and see how I go with the db import. Thanks for the help.

User avatar
battye
Extension Customisations
Extension Customisations
Posts: 10911
Joined: Wed Feb 11, 2004 11:02 am
Location: Australia
Contact:

Re: SQL ERROR 1064 - MariaDB

Post by battye » Mon Mar 18, 2019 2:06 pm

No problem. If you still have no luck, post back and we'll have another look and try to figure it out.
Customisations Team Member

Post Reply

Return to “phpBB Discussion”

Who is online

Users browsing this forum: No registered users and 18 guests