Exemple #1
0
function tep_random_select($query)
{
    $random_product = '';
    $random_query = tep_db_query($query);
    $num_rows = tep_db_num_rows($random_query);
    if ($num_rows > 0) {
        $random_row = tep_rand(0, $num_rows - 1);
        tep_db_data_seek($random_query, $random_row);
        $random_product = tep_db_fetch_array($random_query);
    }
    return $random_product;
}
function tep_db_result($result, $row, $field = '')
{
    if ($field === '') {
        $field = 0;
    }
    tep_db_data_seek($result, $row);
    $data = tep_db_fetch_array($result);
    return $data[$field];
}
            if ($product_row['products_id'] == (int) $_GET['products_id']) {
                if ($product_row = tep_db_fetch_array($products_ids)) {
                    $next_item = $product_row['products_id'];
                }
                break;
            } else {
                $previous = $product_row['products_id'];
            }
        }
    }
    // Products Id of the first product in the category
    tep_db_data_seek($products_ids, 0);
    $product_row = tep_db_fetch_array($products_ids);
    $first = $product_row['products_id'];
    // Products Id of the last product in the category
    tep_db_data_seek($products_ids, $counter - 1);
    $product_row = tep_db_fetch_array($products_ids);
    $last = $product_row['products_id'];
    if ($counter > 1) {
        ?>
	  <!-- Next Previous Module Starts -->
		<table border="0" cellspacing="0" cellpadding="3">
          <tr>
<?php 
        if ($first != (int) $_GET['products_id']) {
            ?>
            <td align="right" class="main" width="40"><?php 
            echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, "{$fPath}&products_id={$first}") . '">' . tep_image(DIR_WS_ICONS . 'control_start.png', ALT_FIRST_PRODUCT) . '</a>  <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, "{$fPath}&products_id={$previous}") . '">' . tep_image(DIR_WS_ICONS . 'control_rewind.png', ALT_PREVIOUS_PRODUCT) . '</a>';
            ?>
</td>
<?php