Syntax error or access violation - Laravel
<p>I'm trying to select data from a database and unfortunately I'm getting the following error: </p>
<p>"Syntax error or access violation: 1064 There is an error in your SQL syntax; please check the manual for your MariaDB server version for use around 'to,amount,from,date,status,provider from Correct syntax for api_transactions where=?' in file /home/nosi/myProjects/paylesotho/vendor/laravel/framework/src/Illuminate/Database/, line 1 (SQL: SELECT MerchantName,To,Amount from api_transactions , from, date, status, provider, where to=00000) Connection.php line 664
”</p>
<p>Here's what I'm doing inside the controller: </p>
<pre class="brush:php;toolbar:false;">public function TransactionDetails ($merchant_id){
$client_data = DB::select('SELECT merchant_name,to,amount,from,date,status,provider from api_transactions where to=?', [$merchant_id]);
return response()->json($client_data);
}</pre></p>