How do I use the MySQL Variables that I used in DB::statement(). I put the two variables there which are @num and @type.
I have a query builder after the DB::statement() which will used the @num and @type variables.
Upon running, both variables return NULL since it cannot get the MySQL variables.
| id | number | type |
|---|---|---|
| 1 | (NULL) | (NULL) |
| 2 | (NULL) | (NULL) |
| 3 | (NULL) | (NULL) |
| 4 | (NULL) | (NULL) |
| 5 | (NULL) | (NULL) |
| 6 | (NULL) | (NULL) |
| 7 | (NULL) | (NULL) |
| 8 | (NULL) | (NULL) |
| 9 | (NULL) | (NULL) |
| 10 | (NULL) | (NULL) |
Expected output should be:
| id | number | type |
|---|---|---|
| 1 | 1 | 2 |
| 2 | 1 | 2 |
| 3 | 1 | 2 |
| 4 | 1 | 2 |
| 5 | 1 | 2 |
| 6 | 1 | 2 |
| 7 | 1 | 2 |
| 8 | 1 | 2 |
| 9 | 1 | 2 |
| 10 | 1 | 2 |
Here's the actual code:


