updata 'row +1' - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: updata 'row +1' (/showthread.php?tid=36874) |
updata 'row +1' - El Forum - 12-17-2010 [eluser]mo2men[/eluser] hi when i update views row i get in mysql 0 !!!!!!!! but i want views +1 Code: function update_scam(){ updata 'row +1' - El Forum - 12-17-2010 [eluser]JHackamack[/eluser] Have you tried echoing out your query with: Code: echo $this->db->last_query(); Another way you can do it is using: Code: $this->db->query('UPDATE the_table SET the_field = the_field + 1 WHERE [your WHERE clause]'); updata 'row +1' - El Forum - 12-18-2010 [eluser]mo2men[/eluser] ok i use this query $query = $this->db->query("UPDATE topic SET view = view +1 where row = $integer "); and i get Unknown column 'site.com' in 'where clause' UPDATE scam SET report = report +1 where site = site.com i think problem whit $integer because when i use query without where i get true query help ? how i can wrote this query true updata 'row +1' - El Forum - 12-18-2010 [eluser]Twisted1919[/eluser] $this->db->set('view','view+1',FALSE)->where('row',$integer)->update('topic'); updata 'row +1' - El Forum - 12-18-2010 [eluser]Pschilly[/eluser] Last one is best option... That way it uses the built in cleaning of the query stuff. |