All pastes #86044 Raw Edit

Someone

public text v1 · immutable
·published 2006-07-12 13:43 UTC
rendered paste body
echo $sql = "SELECT itemId, userId, description, date, city, county, idNum, name, price, type FROM (items JOIN user ON items.userId=user.ID) LEFT JOIN images ON items.itemId=images.idNum ";
if (isset($_GET['type'])) { $sql .= " WHERE type='". urlencode($_GET['type'])."'"; }
$sql .="group by itemId";
$result_count = mysql_query($sql) or die ("MySQL Error: ".mysql_error());
$numofrows = mysql_num_rows ($result_count);

//pagination total number of rows
if(empty($page)){    // Checks if the $page variable is empty (not set)
        $page = 1;      // If it is empty, we're on page 1
    }

     $limitvalue = ($page - 1) * $limit;
    // Ex: (2 * 25) - 25 = 25 <- data starts at 25


//pagination query2
echo $sql1 = "SELECT itemId, userId, description, date, city, county, idNum, name, price, type FROM (items JOIN user ON items.userId=user.ID) LEFT JOIN images ON items.itemId=images.idNum";
if (isset($_GET['type'])) { $sql1 .= " WHERE type='". urlencode($_GET['type'])."'"; }
$sql1 .= " GROUP BY itemId";