PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
tempex
Forum Newbie
Posts: 3 Joined: Wed Jul 11, 2012 4:38 am
Post
by tempex » Wed Jul 11, 2012 4:44 am
Hello,
Need a little help to execute query below in php
The query goes well in DB2 command editor, but I do not have any idea how to execute it in php.
Code: Select all
xquery for $d in db2-fn:xmlcolumn('TERM.TERM')
where fn:contains($d/term, '$keyword')
return $d
Thanks in advanced.
requinix
Spammer :|
Posts: 6617 Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA
Post
by requinix » Wed Jul 11, 2012 2:33 pm
Try a simple
Code: Select all
"xquery for \$d in db2-fn:xmlcolumn('TERM.TERM')\nwhere fn:contains(\$d/term, '$keyword')\nreturn \$d"
(assuming $d is a DB2 variable and $keyword is a PHP variable). I don't think the newlines are necessary but I threw them in anyways.
If you're asking about how to query a DB2 database in general then you need to find yourself a tutorial on the subject.
tempex
Forum Newbie
Posts: 3 Joined: Wed Jul 11, 2012 4:38 am
Post
by tempex » Wed Jul 11, 2012 10:48 pm
Thank you very much for the advice.
It's work.
However if only the $keyword is in English.
If I insert Japanese character in there, no result is return.
I wonder why..