我确实对数据库表有一点了解,但我无法读取db_query 我相信有一个查询应该将产品作为畅销书并将其放在滚动条中。我想伪造一本畅销书,因为在打开一个空畅销书清单的网店时看起来有点倾销。
我手动更改了表“products_ordered”并将产品列更改为3(就像产品订购了3次)仍然没有在滚动条中发生任何事情。接下来我该怎么办?
我做错了什么?
这是查询:
$best_sellers_scroll_query = tep_db_query("select distinct p.products_id,
pd.products_description, p.products_image, p.products_price,
p.products_tax_class_id, pd.products_name from " .
TABLE_PRODUCTS . " p, " .
TABLE_PRODUCTS_DESCRIPTION . " pd, " .
TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " .
TABLE_CATEGORIES . " c where p.products_status = '1' and
p.products_ordered > 0 and p.products_id = pd.products_id and
pd.language_id = '" .
(int)$languages_id . "' and p.products_id = p2c.products_id and
p2c.categories_id = c.categories_id and '" .
(int)$current_category_id . "' in (c.categories_id, c.parent_id)
order by p.products_ordered desc, pd.products_name limit " .
MAX_DISPLAY_BESTSELLERS_SLIDER);
这是slider.js
var prepare_slider = function(x_cols, x_dur){
var x_pos = 0;
var li_items_n = 0;
var li_col = $('slider_list').getElements('li');
li_col.each(function(li, index){
size = li.getSize();
x_pos += size.x;
li_items_n++;
})
$('slider_list').setStyle('position','relative');
$('slider_list').setStyle('left','0px');
$('slider_list').setStyle('width', x_pos+'px');
/* alert("The element is "+size.x); */
var myFx = new Fx.Tween($('slider_list'), {transition:
Fx.Transitions.Sine.easeOut, duration:x_dur});
myFx.addEvent('start', function(){ is_playing = true; });
myFx.addEvent('complete', function(){ is_playing = false; });
var is_playing = false;
$('left').addEvent('click', function(){
cur_offset = $('slider_list').getStyle('left').toInt();
if (!is_playing && ((cur_offset + size.x) <= 0))
myFx.start('left', cur_offset + size.x + 'px');
});
$('right').addEvent('click', function(){
var is_playing = false;
cur_offset = $('slider_list').getStyle('left').toInt();
if (!is_playing && ((cur_offset - size.x)
>= (x_cols*size.x-x_pos) )) myFx.start('left', cur_offset - size.x + 'px');
});
}
转储的结果:
string(179) "4' and p.products_id = p2c.products_id
and p2c.categories_id = c.categories_id and '0' in (c.categories_id,
c.parent_id) order by p.products_ordered desc,
pd.products_name limit 1" 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 ''0' at line 1
select distinct p.products_id, pd.products_description,
p.products_image, p.products_price, p.products_tax_class_id,
pd.products_name from products p, products_description pd,
products_to_categories p2c, categories c where
p.products_status = '1' and p.products_ordered > 0 and
p.products_id = pd.products_id and pd.language_id = '0
[TEP STOP]
答案 0 :(得分:0)
您必须检查查询找不到产品的原因:
products_ordered
列的位置(查找products_id
)products_status = 1
products_description
中的条目是否与您当前语言的products_id
和language_id
相同(执行var_dump($languages_id)
)products_to_categories
中的条目是否与您当前类别的products_id
和categories_id
相同(执行var_dump($current_category_id)
)categories
检查MAX_DISPLAY_BESTSELLERS_SLIDER > 0
将“WHERE
”替换为“WHERE TRUE OR
”