
Originally Posted by
DrByte
The semicolon is closing the two IF statements.
If you want to nest IF statements, and incorporate ELSE statements also, then you'd be better off using full brace structure.
Code:
if (condition)
{
if (condition)
{
statement;
} else {
statement;
}
}
Ahhh ok...so this:
PHP Code:
$num_products_count = ($recent_products_query == '') ? 0 : $recent_products->RecordCount();
// show only when 1 or more
if ($num_products_count > 0)
if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_RECENT_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_RECENT_PRODUCTS == 0)
$col_width = floor(100/$num_products_count);
} else {
$col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_RECENT_PRODUCTS);
becomes this?
PHP Code:
$num_products_count = ($recent_products_query == '') ? 0 : $recent_products->RecordCount();
// show only when 1 or more
if ($num_products_count > 0)
{
if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_RECENT_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_RECENT_PRODUCTS == 0)
{
$col_width = floor(100/$num_products_count);
} else {
$col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_RECENT_PRODUCTS);
}
}
Edit: Ok, I tried the above but I must have done something wrong, because I'm still getting this error:
PHP Parse error: syntax error, unexpected T_ELSE in /includes/modules/recent_products.php on line 57