<?
// get the list of resellers from the db
$res = mysql_query("SELECT * FROM resellers ORDER BY id");

// print all records in the DB
while ($myrow = mysql_fetch_array($res)){
echo "<tr><td><div align='center'><font
class=\"content\">".$myrow['id']."</font></div> </td><td>&nbsp;</td><td><div
align='justify'><font
class=\"content\">".$myrow['company']."</font></div></td>";
	printf("<td><font class='content'><a
href=\"%s?op=resellers&id=%s&delete=yes\">(DELETE)</a></font></td></tr>",
$PHP_SELF, $myrow["id"]);
}?>
There's an easier way to display this. It should make your life easier...made mine.

Take a look:

<?
// get the list of resellers from the db
$res = mysql_query("SELECT * FROM resellers ORDER BY id");

// print all records in the DB
while ($myrow = mysql_fetch_array($res)): ?>
<tr><td><div align='center'>
<font class="content"><?=$myrow['id']?></font>
</div></td><td>&nbsp;</td><td>
<div align='justify'><font class="content">
<?=$myrow['company']?></font></div></td><td><font class="content">
<a href="<?=$PHP_SELF?>?op=resellers&id=<?=$myrow['id']?>&delete=yes">
(DELETE)</a></font></td></tr>
<? endwhile; ?>


now when I click on delete it just reloads the page and doesn't delete the
record. I have this code before anything else on the page to handle the
delete...

if($delete){
$res= mysql_query("DELETE FROM resellers WHERE id=$id");
header("Location: admin2.php?op=resellers");
}
What you should do here is check to see if $res is failing, simply by doing the following:

if(!$res) echo "error";

Then, place an 'exit;' after the header(...) command to see if the $delete variable is actually being passed.

--
Kyle Gibson
admin(at)frozenonline.com
http://www.frozenonline.com/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to