I'm using the function db_query() in this code:

[pre]
db_query('INSERT INTO {node_log} (nid, date_log, time_log) VALUES (%d, %s, %s)', arg(1), date("Y-m-d"), date("H:i:s"));
[/pre]

But is not parsing correctly, when i print the code, i have this:

INSERT INTO node_log (nid, date_log, time_log) VALUES (1062, 2007-05-28, 0)

The strings are not parsed!

Anyone knows the motiv?

Comments

nevets’s picture

So

'INSERT INTO {node_log} (nid, date_log, time_log) VALUES (%d, %s, %s)'

would be

"INSERT INTO {node_log} (nid, date_log, time_log) VALUES (%d, '%s', '%s')"

Does this help? (I am not sure what parsing of the string you would expect)

marcuscavalcanti’s picture

Thanks :)

I think that the %s automatically escape the strings.