Welcome Guest, Not a member yet? Register   Sign In
How to write query string?

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 ri.to = ? AND ri.date = ? AND bl.name= ?
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.


Theme © iAndrew 2016 - Forum software by © MyBB