user1464139
user1464139

Reputation:

How can I trace what happens when I try to do a delete using Php?

I have the following code:

<?php
    // configuration
    require("../includes/config.php"); 

    // if form was submitted
    if($_GET['id'])
    {    
        $id = $_GET['id'];
        $id = mysql_escape_string($id);
        $sql = "DELETE FROM city WHERE id = $id";
        mysql_query($sql);
    }
?>

When I try to run this from the browser I get an error message:

http://localhost/delete.php&id=3
The requested URL /delete.php&id=3 was not found on this server

http://localhost/delete.php
 Notice: Undefined index: id in /home/localhost/html/delete.php on line 6

Can someone tell me how I could trace what's happening. Note that the machine I am running on can't run anything like fiddler

Upvotes: 0

Views: 54

Answers (1)

Justin McDonald
Justin McDonald

Reputation: 2166

The first parameter passed in the URL must be delimited with a ?, and all subsequent parameters are delimited with & (When using the GET protocol)

Your URL must be of the form:

delete.php?id=3

With subsequent parameters of the form:

delete.php?id=3&name=foo&page=bar

Upvotes: 3

Related Questions