for some reason Laravel gives me an SQL error when I try to run the following code. The error i get goes as follows:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from `homes` where `Company` = ?' at line 1 (SQL: select from `homes` where `Company` = Abbeyfield)
Here's the code:
<?php
class AnalysisController extends BaseController {
public function getSelect(){
//current USER
$current_user = Auth::user();
echo $relevant_homes = Home::where('Company', '=', $current_user->company_name)->get(array());
/*
return View::make('analysis.select')->with('current_user', $current_user);
*/
}
}
?>
Any ideas?
select from homes where
Company` = Abbeyfield` where is your select column names in your query ?Company
is the column name in this query. It is Eloquent ORMFROM
in select Query~get
the array of column names he wants to get. It is an empty array.