Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2008-10-24 11:24:42
- tbo
- Member
- Registered: 2008-10-24
- Posts: 12
[solved] problem with safe_query()
Hi everyone,
I am new to Textpattern und currently writing (rather trying to write) a small plugin. Therefore I found myself using the safe_* to handle all db-querys.
So far so good, but now I tried to execute a query with safe_query() and it just won’t work – everytime on processing it gives the following error:
Warning: 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 '; UPDATE txp_section SET `es_meta_desc` = NULL,`es_meta_keyw` = NULL,
`es_navi_a' at line 1 UPDATE txp_section SET `es_meta_desc` = NULL,`es_meta_keyw` = NULL,`es_navi_area` = 'b',
`es_navi_order` = '1' WHERE CONVERT(`name` USING utf8) = 'default' LIMIT 1; UPDATE txp_section SET `es_meta_desc` = NULL,
`es_meta_keyw` = NULL,`es_navi_area` = 'b',`es_navi_order` = '0' WHERE CONVERT(`name` USING utf8) = 'kontakt'
LIMIT 1; in [...]/httpdocs/textpattern/lib/txplib_db.php on line 81
If I copy the query and run it with phpMyAdmin, everything is fine. Is there something I missed when using safe_query()?
Best regards,
Tobi
PS.: The query-string is build through a function, so using safe_udpate() would produce a bunch of small querys being executed (is this the “more elegant” way of dealing with this issue?), a case I wanted to avoid.
Last edited by tbo (2008-10-24 13:05:13)
Offline
Re: [solved] problem with safe_query()
There’s no need for a trailing semicolon, and you would have to issue the queries one by one. Separating queries by semicola is a feature of phpMyAdmin, not intrinsic to MySQL.
Last edited by wet (2008-10-24 12:38:56)
Offline
#3 2008-10-24 13:04:22
- tbo
- Member
- Registered: 2008-10-24
- Posts: 12
Re: [solved] problem with safe_query()
Ouch – that was stupid of me. Works fine now, thank you very much wet!
Offline