Skip to content

Commit 4223a3b

Browse files
Update SimplePDOQueryBuilder.php
optional from
1 parent 20954cb commit 4223a3b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

SimplePDOQueryBuilder.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,11 @@ public function orderBy($sortBy, $sortOrder = 'DESC')
257257
*/
258258
public function getSql()
259259
{
260-
$query = "\n SELECT " . implode(',', $this->fields) ."\n FROM " . $this->from;
260+
$query = "\n SELECT " . implode(',', $this->fields);
261261

262+
if (!empty($this->from)) {
263+
$query .= "\n FROM " . $this->from;
264+
}
262265
if (!empty($this->joins)) {
263266
$query .= implode(' ', $this->joins);
264267
}
@@ -369,4 +372,4 @@ public function setExtra($extra)
369372
{
370373
$this->extra = $extra;
371374
}
372-
}
375+
}

0 commit comments

Comments
 (0)