Hello,
I have a php script that generates a datafeed.
When i’ve upgraded from 2.0.14 to 2.1.4 it stopped working.
It seems that the category field isn’t extracted correctly.
This is the error i am getting:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in … on line 86
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in … on line 100
```php
// Get all categories
$res_cat = db_query(“SELECT ?:categories.category_id, ?:categories.parent_id, ?:category_descriptions.category, ?:seo_names.name AS seo_name
FROM ?:categories
LEFT JOIN ?:category_descriptions ON ( ?:category_descriptions.category_id = ?:categories.category_id )
LEFT JOIN ?:seo_names ON (?:categories.category_id = ?:seo_names.object_id AND type = ‘c’)
WHERE ?:category_descriptions.lang_code = '” . $lang_code . “'”);
[86] while ($row_cat = mysql_fetch_assoc($res_cat)) {
if ($row_cat[‘parent_id’] > 0) {
$CAT_ARR[$row_cat[‘category_id’]][‘name’] = $CAT_ARR[$row_cat[‘parent_id’]][‘name’] . " > " . $row_cat[‘category’];
$CAT_ARR[$row_cat[‘category_id’]][‘seo_name’] = $CAT_ARR[$row_cat[‘parent_id’]][‘seo_name’] . “/” . $row_cat[‘seo_name’];
}
else {
$CAT_ARR[$row_cat[‘category_id’]][‘name’] = $row_cat[‘category’];
$CAT_ARR[$row_cat[‘category_id’]][‘seo_name’] = $row_cat[‘seo_name’];
}
}
// Get SEO settings
$res_cat = db_query(“SELECT options
FROM ?:addons WHERE addon = ‘seo’”);
[100] while ($field_seo = mysql_fetch_assoc($res_cat)) {
if(strpos($field_seo[‘options’], “product_category”)) {
$seo_type = “product_category”;
}
else {
$seo_type = “product_file”;
}
}
```
This script worked flawlessly with 2.0.14.
Probably something changed in the cs-cart database.
If anyone could help me it would be really great.
Thank you,
Mircea
Your query is failing and you’re not detecting why.
Add error checking and you’ll probably see that a field is no longer there or has changed type.
It appears that you are mixing cs-cart DB syntax (I.e. ? with using standard mysql. Mysql is probably balking at the ?:table_name syntax you are using. Suggest you use the internal database functions rather than mysql directly.