Welcome Guest, Not a member yet? Register   Sign In
MySQL Set Increment Field plus 1
#1

[eluser]RaZoR LeGaCy[/eluser]
Hello,

I was looking at my MySQL Slow Log and noticed this update took 29 seconds.

# Query_time: 29 Lock_time: 0 Rows_sent: 0 Rows_examined: 0
use hh_;
UPDATE `views` SET `hits` = hits+1 WHERE `rid` = '62';

I then ran the query through PHPMYADMIN using explain and received the following message:
Error

SQL query:

EXPLAIN UPDATE `hh_skViews` SET `hits` = hits +1 WHERE `rid` = '62'

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE `views` SET `hits` = hits+1 WHERE `rid` = '62'' at line 1

I use this active record:
$this->db->set('hits', 'hits+1', FALSE);
$this->db->where('rid', $rid);
$this->db->update('views');

Why am I getting an error in mysql and how can I fix this? I am still searching Google but finding the same update syntax.


Messages In This Thread
MySQL Set Increment Field plus 1 - by El Forum - 06-14-2010, 10:27 AM
MySQL Set Increment Field plus 1 - by El Forum - 06-14-2010, 11:20 AM
MySQL Set Increment Field plus 1 - by El Forum - 06-14-2010, 11:25 AM
MySQL Set Increment Field plus 1 - by El Forum - 06-14-2010, 11:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB