Hey i have a piece of code that works great. But when i use DISTINCT as per
<?php
$category = $_GET["state"];
if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; };
$start_from = ($page-1) * $results_per_page;
$sql = "SELECT DISTINCT CITY
FROM $datatable
WHERE STATE='$category'
ORDER BY CITY ASC LIMIT $start_from, $results_per_page" ;
$rs_result = $conn->query($sql);
?>
<table border="1" cellpadding="4" width="100%">
<tr>
<?php
while($row = $rs_result->fetch_assoc()) {
?>
<tr>
<td> <a href="browsepage2.php?state=<? echo $row["STATE"]; ?>&city=<? echo $row["CITY"]; ?>" ><? echo $row["CITY"]; ?></a></td>
</tr>
<?php
};
?>
</table>
The next page the rows wont show? i'm unsure of the problem. the next page's code is as follows.
<?php
$category = $_GET["state"];
$city= $_GET["city"];
if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; };
$start_from = ($page-1) * $results_per_page;
$sql = "SELECT *
FROM $datatable
WHERE STATE='$category'
AND CITY='$city'
ORDER BY PROVNAME ASC LIMIT $start_from, $results_per_page" ;
$rs_result = $conn->query($sql);
?>
<table border="1" cellpadding="4" width="100%">
<tr>
<?php
while($row = $rs_result->fetch_assoc()) {
?>
<tr>
<td> <a href="browsepage2.php?state=<? echo $row["STATE"]; ?>&city=<? echo $row["CITY"]; ?>&shop=<? echo $row["PROVNAME"]; ?>" ><? echo $row["PROVNAME"]; ?></a></td>
</tr>
<?php
};
?>
</table>
I'm kind of unsure where the problem is but i can make it work if i don't use distinct.