
April 16th, 2003, 10:28 PM
|
|
Registered User
|
|
Join Date: Aug 2002
Posts: 28
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
deleting links from db not working after upgrade
After updating from version 4.0 to 4.2 I have encountered a number of problems, all which stem from having globals ON. I've been able to go through and fix just about everything except for when it comes to deleting links from the database.
This is the snippet that displays the links with the respective 'edit' and 'delete' links
PHP Code:
while($myrow = mysql_fetch_array($result))
{
$linkname = $myrow["name"];
$linkid = $myrow["linkid"];
echo $linkname. '<br>';
echo "<a href=\"update.php?linkid=$linkid\" class=mediumbold>Edit</a><br>";
echo "<a href=\"admin.php?linkid=$linkid&task=delete_link\" class=mediumbold>Delete</a><br>";
The last line which calls admin.php is actually admin.php itself. I didn't know how to pass a variable using php self.
Here is the code in admin.php...
PHP Code:
if($task == 'delete_link')
{
$sql = "DELETE FROM links WHERE linkid = $linkid";
$result = mysql_query($sql);
if(!$result)
{
echo("ERROR: " . mysql_error() . "\n$sql\n");
exit();
}
}
I cannot get it to delete for anything. When I hit 'submit', the form just reloads.
Thamks for any input
|