All pastes #87788 Raw Edit

Someone

public text v1 · immutable
·published 2006-07-14 05:56 UTC
rendered paste body
$sql = "SELECT COUNT(*) 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_fetch_array ($result_count);


	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



$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"
$sql1 .= "limit $limitvalue, $limit";
$result = mysql_query($sql1) or die("Error: " . mysql_error());