You are here: Re: why doesn't this delete the record I want it to delete? « PHP Language « IT news, forums, messages
Re: why doesn't this delete the record I want it to delete?

Posted by Steve Belanger on 03/13/07 02:15

if he does not specify a form to submit to then it will likely not work as
intended. Not to mention that depending of server configuration (for
instance register_globals being at Off) then it will not work as php will
not know where $id is coming from.


"Sean" <sean.anderson@[nospam]oakleafgroup.biz> wrote in message
news:1173698341.123284@kestrel.skynet.co.uk...
> "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
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация