S
Asked
Hi, i need a little hint please!
in code i can find for example:
```php
$this->datatables
->select('image, code, name, wp.quantity, alert_quantity')
->from('products')
->join("( SELECT * from {$this->db->dbprefix('warehouses_products')} WHERE warehouse_id = {$warehouse_id}) wp", 'products.id=wp.product_id', 'left')
->where('alert_quantity > wp.quantity', NULL)
->or_where('wp.quantity', NULL)
->where('track_quantity', 1)
->group_by('products.id');
echo $this->datatables->generate();
```
If i'd like to use a full query like for example:
```php
$this->datatables
->query("SELECT a.* FROM ... ORDER BY ...");
echo $this->datatables->generate();
```
But i think i use a wrong syntax... Can you help my with a hint? or what kind of framework i have to check?
Thank you in advance
in code i can find for example:
```php
$this->datatables
->select('image, code, name, wp.quantity, alert_quantity')
->from('products')
->join("( SELECT * from {$this->db->dbprefix('warehouses_products')} WHERE warehouse_id = {$warehouse_id}) wp", 'products.id=wp.product_id', 'left')
->where('alert_quantity > wp.quantity', NULL)
->or_where('wp.quantity', NULL)
->where('track_quantity', 1)
->group_by('products.id');
echo $this->datatables->generate();
```
If i'd like to use a full query like for example:
```php
$this->datatables
->query("SELECT a.* FROM ... ORDER BY ...");
echo $this->datatables->generate();
```
But i think i use a wrong syntax... Can you help my with a hint? or what kind of framework i have to check?
Thank you in advance
- SAnswered**[Mian Saleem](/u/saleem)** Maybe the problem is the column order... from Chrome dev panel:
in default (working):
0: "no_image.png"
1: "XXXXX"
2: "XXXXXn"
3: "676.0000"
4: "1000.0000"
In the custom (not working):
alert_quantity: "1000.0000"
code: "XXXXX"
image: "no_image.png"
name: "XXXXXn"
quantity: "676.0000"
How to solve? I tried inserting in sColumns but seems not working to order... thank you so much! - SAnsweredin default (working):
{"no_image.png", "XXXXX", "XXXXXn", "676.0000", "1000.0000"}
In the custom (not working):
{image: "no_image.png", code: "XXXXX", name: "XXXXXn", quantity: "676.0000", alert_quantity:"1000.0000"}
other differences... - EGAnswered**[Ste](/u/iojedi)** Try the example that I gave you, it should be working.
- MSAnsweredHello,
There is method `result_array()` to get array results of query.
If the column issue you need to check the sColumns and match it with your data.
Thank you - SAnswered**[Enyinnaya Gift](/u/giftedhands4real)** Thank you! I tried it but there is some error in the code... i have error 500 on calling...
- SAnswered**[Mian Saleem](/u/saleem)** I tried with result_array() instead of result() but i have the same result in array:
in default (working): {"no_image.png", "XXXXX", "XXXXXn", "676.0000", "1000.0000"}
In the custom (not working): {image: "no_image.png", code: "XXXXX", name: "XXXXXn", quantity: "676.0000", alert_quantity:"1000.0000"}
Thank you! Very very thankfull for your great help! - EGAnswered**[Ste](/u/iojedi)** Would you mind if I take a look it on your PC?
You can reach me via Skype ID: enyinnayag - SAnswered**[Enyinnaya Gift](/u/giftedhands4real)** THANK YOU so much... my fault! it works!
thank you again to all of you! Great! - SAnsweredLast hint... the alert quantity on the top bar... where is the file with script to edit? thank you again!
- EGAnswered**[Ste](/u/iojedi)** Nice.
Could you please state exactly what worked for you, so that it serves as a reference for others? - Login to Reply