Jump to content

Incrementing a value using pdo (mysql)


RobertP

Recommended Posts

$connection->exec('update plugin_advertisements set out = out+1 where id = '.intval($id).';');

$connection->execute('update plugin_advertisements set out = out+1 where id = ?;',array($id));

 

no luck with either :S

 

if anyone has had this problem and found a viable solution, maybe you can point me in the right direction?

Link to comment
https://forums.phpfreaks.com/topic/263506-incrementing-a-value-using-pdo-mysql/
Share on other sites

out is a reserved mysql keyword and would need to be enclosed in back-ticks to prevent an error in your query. Your query error checking logic would have been giving you an error near the first use of out in the query.

 

thank you so much (did'nt know about the out-keyword)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.