Posted by Sean on 03/12/07 11:23
"Mr. Newt" <lektrikpuke@_yahoo.com> wrote in message
news:EICdnVlmxetj3GnYnZ2dnUVZ_qunnZ2d@comcast.com...
> <?php
> //db & table names used to connect
> include ("connect.php");
> //display a list of names preceeded by id #
> include ("display_names.php");
> ?>
> <p>Which record would you like to delete?</p>
> <P>Enter Record #<br>
> <input type=text name="id" size=20>
> <input type=submit name="submit" value="Delete Record">
> <?php
> mysql_query("DELETE FROM testtable WHERE id=$id");
> ?>
>
> The above deletes the last record in the table. Obviously it's not
> getting
> the # that is being entered. Any help?
>
> Thanks.
>
> Robert
>
>
Looks correct.
Comment out the deletion line and add in
echo "Record to be deleted is $id";
To check the id of the record to go.
You could also query the table to check that there is only only record with
the matching 'id'.
Sean
[Back to original message]
|