7 Posts
ptbberlin
8 years ago
Topic

Hi,

I use databaser and it works ok when I also use an number for searching for example id=2 oder id=*value*. Unfortunately I have to search by numer and text: "select * from #__tabel where id=*value* and fd_name = 'tb_name'. In this case I get the errormsg: "You have an error in your SQL syntax near tb_name". I tryed it with all combinations of fd_name = ... (like 'tb_name', like "tb_name", with and without "%". always the same errormsg. 

Also a query with only a textfield the same error. To check the query i used myphpadmin (copy and paste) and it works. 

Now I have no more ideas :-((

Is there a restriction in the databaser?? Or any other idea??

Peter

Get a VIP membership
4229 Posts
Kadministrator
8 years ago
1
Level 1

Hi,

how does the whole query from error look? Probably this is just a problem with some quotes or similar.

7 Posts
ptbberlin
8 years ago
0
Level 2

Hi Klas, 

here the Qurey-variationes:

select * from jam_cck_store_form_zitate where vk_feld_id =*value* and vk_feld_name='tb_name';

select * from jam_cck_store_form_zitate where vk_feld_id =*value* and vk_feld_name="'tb_name";

select * from jam_cck_store_form_zitate where vk_feld_id =*value* and vk_feld_name like 'tb_name';

select * from jam_cck_store_form_zitate where vk_feld_id =*value* and vk_feld_name like '%tb_name%';

and

select * from jam_cck_store_form_zitate where  vk_feld_name='tb_name';

in the 4 varantiones.

The answer always:

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 '\'tb_name\'' at line 1 SQL=select * from jam_cck_store_form_zitate where vk_feld_id =2364 and vk_feld_name=\'tb_name\';

As I wrote above all  queries are working in myPHPAdmin (copy and paste)

4229 Posts
Kadministrator
8 years ago
1
Level 1

Hi,

this is unfortunatelly impossible with this sd version as it escapes special characters like ' or " - if you trust your users that have access to seblod administration you can change this line in sd databaser plugin:

$sql = addslashes(preg_replace($sdPattern, $sdReplace, $sql));

to

$sql = preg_replace($sdPattern, $sdReplace, $sql);

7 Posts
ptbberlin
8 years ago
0
Level 2

It works!!!

Thank's a lot

Peter

Get a Book for SEBLOD