problems deleting multiple rows
Posted: Tue Jul 30, 2002 3:24 pm
I've been trying to delete multiple rows from sql, I have a link on a seperate page that is passing the variable expire date. Now even when I set the variable to a normal page variable before doing the sql stuff, i still get nothing deleted. I echo out the variable and nothing appears, yet just above the code, I have a table echoing out all the accounts that contain the info in the column pertaining to expire_date
the code is rather long, but here is the entire thing:
the table in the middle echoes out all the accounts with the current expire_date, yet i can't delete them, any ideas?
the code is rather long, but here is the entire thing:
Code: Select all
<?php
if (!$action) {
?>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif">The
following accounts have expired this month, to delete them click
on the button below.</font></p>
<form name="form1" method="post" action="<?=$PHP_SELF?>">
<div align="center">
<input type="submit" name="action" value="Delete Expired Accounts">
</div>
</form>
<Br>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#003300">
<tr>
<td bgcolor="#F0FFE0"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Expiration
Month</font></td>
<td bgcolor="#F0FFE0"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Subscriber
Name</font></td>
<td bgcolor="#F0FFE0"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Account
Username</font></td>
<td bgcolor="#F0FFE0"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Email</font></td>
</tr>
<?php do { ?>
<tr bgcolor="#FFFFFF">
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><?php echo $row_expiredї'expire_date']; ?></font></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><?php echo $row_expiredї'firstname']; ?> <?php echo $row_expiredї'lastname']; ?></font></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><?php echo $row_expiredї'username']; ?></font></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><?php echo $row_expiredї'email']; ?></font></td>
</tr>
<?php } while ($row_expired = mysql_fetch_assoc($expired)); ?>
</table>
<?php
}
else {
$sql = "DELETE FROM newsletterusers WHERE expire_date = '$expire_date'";
$result = mysql_query($sql) or die(mysql_error());
?><BR><BR><BR><BR>
<p align="center"><font size="2" face="verdana, Arial, helvetica, sans-serif"><BR><BR><BR>The following accounts have expired and been deleted.</font><BR><BR><BR><a href="javascript:history.back()">Back to Admin Main</a></p><BR><BR><BR>
<?php
}
?>