I am trying to select data from the database, unfortunelety I am getting below error :
"Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'to,amount,from,date,status,provider from api_transactions where to=?' at line 1 (SQL: SELECT merchant_name,to,amount,from,date,status,provider from api_transactions where to=00000) in file /home/nosi/myProjects/paylesotho/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 664 "
Below is what I did inside the controller:
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);
}