0

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.

2 Answers 2

6

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

Sign up to request clarification or add additional context in comments.

1 Comment

INNER JOIN {accesslog} a ON n.nid = REPLACE(a.path, "node/", "") do work! thank you!
2

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

1 Comment

INNER JOIN {accesslog} a ON n.nid = REPLACE(a.path, "node/", "") do work! thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.