CodeIgniter Forums
How to write query string? - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: How to write query string? (/thread-52617.html)

How to write query string? - El Forum - 06-19-2012

I have some trouble to query data. The query string is as follow.

$sql = "SELECT ri.routeid, bi.maxseat FROM ytp_routeinfo AS ri
INNER JOIN (ytp_businfo AS bi LEFT JOIN ytp_busline AS bl ON bi.lineid=bl.lineid)
ON ri.busid=bi.busid
WHERE ri.from = ? AND = ? AND = ? AND ?
ORDER BY ri.time ASC";
$this -> db -> query($sql, array($from, $to, $date, $busline));

I use table prefix. In above query string the table name are unknown because of table prefix miss.

In this query string ("$this -> db -> get('city')") no need to add table prefix. I want to write like this.