First: Figure out which will be next:
SELECT month AS m, year AS y
FROM `table`
WHERE id='$id'
SELECT id AS new
FROM `table`
WHERE month=m
AND year=m
AND newIssue=0
ORDER BY date DESC
LIMIT 1
DELETE FROM `table` WHERE id='$id'
UPDATE `table` SET newIssue=1 WHERE id=new
Those queries in that order should work for you.
In PHP it would go:
<?php
$id = $_GET['id'];
$query['sel_del'] = "SELECT month AS m, year AS y
FROM `table`
WHERE id='$id'";
$query['sel_new'] = "SELECT id AS new
FROM `table`
WHERE month='$m'
AND year='$y'
AND newIssue=0
ORDER BY date DESC
LIMIT 1";
$query['delete'] = "DELETE FROM `table`
WHERE id='$id'";
$query['update'] = "UPDATE `table`
SET newIssue=1
WHERE id='$new'";
$con = mysql_connect('host', 'user', 'pass');
mysql_select_db('db', $con);
$rslt = mysql_query($query['sel_del']);
$m = mysql_result($rslt, 0, 'm');
$y = mysql_result($rslt, 0, 'y');
$rslt2 = mysql_query($query['sel_new']);
$new = mysql_result($rslt2, 0, 'new');
$rslt3 = mysql_query($query['delete']);
$rslt4 = mysql_query($query['update']);
?>
~Brett