134 Posts
root
5 years ago
Topic

Hi @ll,

One of my sites made with Seblod, since last update from 3.16.3 to 3.17.1, has an error. The site throws Error: 1064 and this message:

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 '' at line 3

After investigating I found the problem is with a small snippet that some fields have on Code BeforeRender field in order to retrieve some properties, e.g.:

$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('name');
$query->from('#__users');
$query->where(('id')." = ".$fields['art_created_by']->value);
$db->setQuery($query);
$fields['app_user']->form = '<input id="app_user" name="app_user" value="'.$db->loadResult().'" class="inputbox" type="hidden" />';
$db->freeResult();<br>

The problem is with some simple or double quote, probably in line 5 ($jquery->where()...) but I'm unable to solve it. Before the update that snippet was working perfectly. Maybe I'm missing something in the Seblod changelog...

Any help will be much appreciated

Best regards to all Sebloders

Adonay

Get a VIP membership
4229 Posts
Kadministrator
5 years ago
3
Level 1

Did you also update all additional plugins like above mentioned code pack? They all need to be updated with the Seblod update for compatibility.

134 Posts
root
5 years ago
2
Level 2

Hi Klas,

Yes, I forgot to mention that the plugins are also up to date,

pkg_cck_field_seblod_1.7.1 and

pkg_cck_field_code_1.6.0. All is up to date.

I can confirm the error is on line 5, in the clause where... But I don't know why the update affects that, and what is the misspelling... The code seems right

$query->where(('id')." = ".$fields['art_created_by']->value);<br>

if I change that for

$query->where(('id')." = 222");

it works... but obviously that's only for testing purposes...

EDIT: The problem seems to come from art_created_by, but I still don't understand why...

4229 Posts
Kadministrator
5 years ago
1
Level 3

Try enclosing the value in quotes, could be it comes as string

$query->where(('id')." = '".$fields['art_created_by']->value . "'");
134 Posts
root
5 years ago
0
Level 4

Hi Klas,

You just save my day, my friday, my week and my ass

Thank you so much!

Get a Book for SEBLOD