![]() |
Select by active record... help - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Select by active record... help (/showthread.php?tid=38557) |
Select by active record... help - El Forum - 02-11-2011 [eluser]Unknown[/eluser] Hello! I'm sorry for my English I try to select from database (mysql) by ActiveRecord Code: $this->db->select('results.id_url, results.checktime, results.result, results.responsetime, results.responselength, results.responsespeed, urls.url') sql code of this query: SELECT `url_results`.`id_url`, `url_results`.`checktime`, `url_results`.`result`, `url_results`.`responsetime`, `url_results`.`responselength`, `url_results`.`responsespeed`, `url_urls`.`url` FROM (`url_results`, `url_urls`) WHERE `url_results`.`id_url` = '1' AND `url_urls`.`id_url` = 'url_results.id_url' please, Help me to create righty query ![]() If I write '...->where("url_results.id_url =".$urlId." and url_urls.id_url = url_results.id_url")' to query return data, but this syntax does not suit me... UPD: I'm using tableprefix "url_" Select by active record... help - El Forum - 02-13-2011 [eluser]sikko[/eluser] Well, this is how I would do it: Code: $this->db->select('ur.id_url, ur.checktime, ur.result, ur.responsetime, ur.responselength, ur.responsespeed, uu.url'); Please note the false in the last where clause. It's used for the field name not to be escaped. Try it and let us know. Select by active record... help - El Forum - 02-13-2011 [eluser]Unknown[/eluser] Thank you! Code: $this->db->select('a.id_url, a.checktime, a.result, a.responsetime, a.responselength, a.responsespeed, b.url') excellent! |