4 years ago
3
Topic

Hi

Following https://www.seblod.com/resources/tutorials/using-the-search-query-field-plugin is there something wrong to write a SEARCH QUERY (https://www.seblod.com/store/extensions/19157) field with the query ?

SELECT title,id FROM #__content WHERE id=$uri->getValue('id')

When I do so I get an error 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 '' at line 1

Thanks for your help

cyril

Get a Book for SEBLOD
12 Posts
Manish
4 years ago
2
Level 1

That should work in most cases.

You can try to use- $fields['id']->value or $cck->getValue('id')   in place of $uri->getValue('id').

If that does not work, you can try to enable Debugger mode and check what the final query looks like.

4 years ago
1
Level 2

Hi

Thanks

 the solution was to use encapsulate $uri->getValue('id') with double quotes

SELECT title,id FROM #__content WHERE id="$uri->getValue('id')"

Thanks 

cyril

12 Posts
Manish
4 years ago
0
Level 3

I'm glad you were able to solve it. I have a similar problem going on, would you mind having a look and share what you think.
https://www.seblod.com/community/forums/fields-plug-ins/use-a-field-value-in-a-query-query-plugin-used

I'm trying to take the value of a hidden field and use it in the Query (added as a field using seblod query plugin) using $cck->getValue, but it always comes back as a syntax error, just like the one you encountered.

Get a Book for SEBLOD