<?php
include 'scripts/connection.php';
include 'scripts/generic.php';
$query = mysql_query("SELECT idname, thumburl, id FROM images order by id");
//deal with first row
$row = mysql_fetch_array($query);
$prev = $row['idname'];
echo $prev;
//deal with the rest
while ($row = mysql_fetch_array($query))
{
if ($row['idname'] != $prev)
{
echo "<br><br><br>$row[idname]";
}
else
echo "<a href=\"imagesubmit.php?id=$row[id]\"><img src=\"$row[thumburl]\"></a>";
$prev = $row['idname'];
}
$query = mysql_query("select distinct idname from images");
while ($row = mysql_fetch_array($query))
{
$groups[] = $row['idname'];
}
echo "<form action=\"scripts/delete.php\">
<select name=\"deletecolumn\">";
foreach ($groups as $value)
{
echo "<option value=\"$value\">$value</option>";
}
echo "</select><input type=\"submit\" name=\"deletebutton\" value=\"delete group?\"></form>";
?>
The problem I'm having right now is that for every new group, it's skipping the first ID. So the first thumbnail's url is id=2, instead of id=1. Also, let's say group 1 has 10 images. The start of group 2 SHOULD be id=11. But instead, it's id=12, skipping the first of the group. Any ideas?