php - Can you use query builder to build a query with a dynamic WHERE clause at runtime in laravel3? -
i know in laravel 4 can create dynamic clause @ runtime following question:
can use query builder build query dynamic clause @ runtime in laravel?
but can same in laravel 3?
if not, option instead create raw sql code in following:
$sql = "select * " . $table; $first = 1; foreach($items $key => $val) { if($first) $sql .= " "; else $sql .= " , "; $sql .= $key . " " . $val; $first = 0; }
it works pretty exact same way. use $query = db::table('tablename');
in place of first line in related post use rest of example shows.
Comments
Post a Comment