Hi everyone, I am new to php. I am using a piece of code which is
testing if a certain variable is <=0. and the code is written as
follows:
$lc_align = 'center';
if ($listing['products_quant ity']<=0) {
$lc_text = tep_image_butto n('button_buy_n ow_na.gif',
IMAGE_BUTTON_BU Y_NOW_NA) . ' ';
} else {
$lc_text = '<a href="' . tep_href_link(b asename($PHP_SE LF),
tep_get_all_get _params(array(' action')) .
'action=buy_now &products_id =' . $listing['products_id']) . '">' .
tep_image_butto n('button_buy_n ow.gif', IMAGE_BUTTON_BU Y_NOW) .
'</a> ';
}
break;
}
The problem I am facing is that the this code returns all result to be
true ie. <=0 even though most of the variable are greater than 1. Is
the test wrong?
Or can I change the syntax and how do I do that
Any suggestion are welcomed.
Thanks
testing if a certain variable is <=0. and the code is written as
follows:
$lc_align = 'center';
if ($listing['products_quant ity']<=0) {
$lc_text = tep_image_butto n('button_buy_n ow_na.gif',
IMAGE_BUTTON_BU Y_NOW_NA) . ' ';
} else {
$lc_text = '<a href="' . tep_href_link(b asename($PHP_SE LF),
tep_get_all_get _params(array(' action')) .
'action=buy_now &products_id =' . $listing['products_id']) . '">' .
tep_image_butto n('button_buy_n ow.gif', IMAGE_BUTTON_BU Y_NOW) .
'</a> ';
}
break;
}
The problem I am facing is that the this code returns all result to be
true ie. <=0 even though most of the variable are greater than 1. Is
the test wrong?
Or can I change the syntax and how do I do that
Any suggestion are welcomed.
Thanks
Comment