broken code after register globals are off
Posted: Thu Apr 17, 2003 2:10 pm
Hi,
The following (abbreviated) code used to work before register globals was turned off, now it doesn't. Actually the update part works, the delete part doesn't. I've gone through a ton of code and was able to fix everything but this.
The while loop justs pulls the links from the db and displays them. I pass the variable $task=delete_link in the querystring to invoke the top block of code. Simple stuff, but not working after upgrading to 4.2
Can someone point me in the right direction?
Thanks
The following (abbreviated) code used to work before register globals was turned off, now it doesn't. Actually the update part works, the delete part doesn't. I've gone through a ton of code and was able to fix everything but this.
The while loop justs pulls the links from the db and displays them. I pass the variable $task=delete_link in the querystring to invoke the top block of code. Simple stuff, but not working after upgrading to 4.2
Code: Select all
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();
}
}
$sql = "SELECT * FROM links order by linkid asc";
$result = mysql_query($sql);
while($myrow = mysql_fetch_array($result))
{
$linkname = $myrow["name"];
$linkid = $myrow["linkid"];
echo "<tr>";
echo "<td>$linkname</td>\n";
echo "<td><A HREF="update.php?linkid=$linkid" class=mediumbold>Edit</a></td>";
echo "<td><A HREF="admin.php?linkid=$linkid&task=delete_link" class=mediumbold>Delete</a></td>";
echo "</tr>";
}Thanks