PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Ok, ive made a simple script which adds data to a mysql database, ive also made it display. Now, I wrote this piece of code to delete the row but it isnt working and I'm not sure why.
<?php
if(isset($_GET['action']) && $_GET['action'] === 'del') {
$key = $_GET['id'];
$db = mysql_connect('localhost','****','****') or die("could not connect");
mysql_select_db("util", $db) or die("could not get database");
$query = "DELETE FROM util WHERE id = $key";
mysql_query($query);
}
?>
crazycaddy wrote:
The url i was typing was index.php?Action=del&id=1
when it should of been index.php?action=del&id=1
Not to rag on you but that's a rather dangerous url string no? For example, if you were a banking institution an each id represented a charge against a users account, then a savy user could have those charges (purchases) deleted from his system!
You may want to consider POST'ing this information.