im using drupal 6.15 and doing my first project in drupal . i got an issue while running the below query with db_query
i have drupal,delhi keywords in column ‘tag’ with table name tagging.
db_query(SELECT * FROM {tagging} WHERE tag LIKE ‘%drup%’) wont retrieve the correct output.
it show null but the query modified like this,
db_query(SELECT * FROM {tagging} WHERE tag LIKE ‘drup%’) retrieve “drupal” as output
finally i used the php core mysql_query
mysql_query(SELECT * FROM tagging WHERE tag LIKE ‘%drup%’) it retrieve the exact n correct output “drupal” .
is any one have solution ,
Thanxs,
Gobi
It is best for security reasons to use modifiers in db_query.
The following modifiers are available: (see http://api.drupal.org/api/function/db_query)
%s for strings
%d for integer
%f for floating point
%b for binary type
%% for %
Write your query as follows: