check this code to get tasks 
// Rm APIs end

 public function actiongetRMTasks() { 
 if ( !$token=adminComponent::getAdminByToken($this->data['token'])) {
 $this->msg=self::t("Token not valid");
 $this->output();
 Yii::app()->end();
 } 

 $tasks = array();

 $stmt = "SELECT \* FROM tbl\_task ORDER BY task\_id DESC";

 $tasks = $this->rm->createCommand($stmt)->queryAll();

 $this->details = array(
 'data' => $tasks,
 ); 
 $this->code = 1;
 $this->output();

 }
check this code to get tasks 
// Rm APIs end

 public function actiongetRMTasks() { 
 if ( !$token=adminComponent::getAdminByToken($this->data['token'])) {
 $this->msg=self::t("Token not valid");
 $this->output();
 Yii::app()->end();
 } 

 $tasks = array();

 $stmt = "SELECT \* FROM tbl\_task ORDER BY task\_id DESC";

 $tasks = $this->rm->createCommand($stmt)->queryAll();

 $this->details = array(
 'data' => $tasks,
 ); 
 $this->code = 1;
 $this->output();

 }

 it is working fine but i want to get the tasks by user id so i have to change the query to

 $stmt = "SELECT \* FROM tbl\_task WHERE user\_id = ".$token['user\_id']." ORDER BY task\_id DESC";

 but when i do this it shows error

 Error: 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 ''10' at line 1

 how can i solve this

 It seems like you are trying to concatenate a string with a number in your SQL query, which is causing the syntax error. To fix this, you should use a parameterized query instead of directly concatenating the values in the SQL query. This will help prevent SQL injection attacks and syntax errors.

In Yii, you can use the `:param` syntax to create parameterized queries. Here's how you can modify your code:

```php
$stmt = "SELECT * FROM tbl_task WHERE user_id = :user_id ORDER BY task_id DESC";

$params = array(':user_id' => $token['user_id']);

$tasks = $this->rm->createCommand
Your code appears to be a method in a PHP class that retrieves tasks from a database and returns them in a structured format. Here’s a review of the code, highlighting potential improvements and best practices:

### Code Review

1. **Token Validation**:
   - The token validation is handled properly by checking if the `getAdminByToken` method returns a valid admin. If not, an error message is set and the output is returned.
   - Consider using more descriptive error messages for better debugging.

2. **SQL Query**:
   - The SQL statement uses a wildcard `*` to select all columns from the `tbl_task` table. While this is acceptable for prototyping, it's generally better to specify only the columns you need. This practice improves performance and reduces memory usage.
   - Consider using prepared statements to prevent SQL injection attacks, even if the query is straightforward.

3. **Fetching Data**:
   - The method `queryAll()` is appropriate for fetching all rows as an associative array. Ensure that the database connection and command execution is properly handled.

4. **Response Structure**:
   - The `$this->details` array is set correctly to hold the tasks data, but make sure to handle cases where no tasks are found. You might want to return an empty array or a specific message indicating that no tasks exist.
   - It's good that you set `$this->code` to `1` to indicate success. Consider adding a `$this->msg` for