junshin
junshin

Reputation: 3

I want to use php function in SQL query,

I want to use str_replace() in SQL query,

db_query('SELECT * FROM {node} n INNER JOIN {accesslog} a ON n.nid = str_replace("node/", "", a.path); 

but still not work. please help.

thank you.

Upvotes: 0

Views: 188

Answers (2)

anon
anon

Reputation:

Use MySQL's REPLACE function instead of PHP's str_replace.

Upvotes: 2

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 799062

Pick a function that the SQL engine does know, such as REPLACE().

Upvotes: 6

Related Questions