Re: creating log files out of a delete statement
| From: | Robert Sossomon | Date: | Mon, 12 Apr 2004 01:56:44 +0000 |
| Subject: | Re: creating log files out of a delete statement | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-183138@lists.php.net to get a copy of this message | ||
How are you passing the name through?? If using a form to do it then just
use the $_POST[name] or $_GET[name] in the logfile. You have to have the
name pull in the previous page, just pass it through:
<input type="hidden" name="delete_record_name"
value="selection_1">
or:
<a href="delete.php?delete_record_name=selection_1
next page:
if (!$_GET[delete_record_name])
$del_name = $_POST[delete_record_name];
else
$del_name = $_GET[delete_record_name];
$delete_item = "delete from db where name = '$del_name'";
mysql_query($delete_item) or die(mysql_error());
HTH,
Robert
> got it will try that instead..
>
> ----- Original Message -----
> From: "John W. Holmes" <holmes072000@charter.net>
> To: "Andy B" <aborka1@wmis.net>
> Cc: <php-general@lists.php.net>
> Sent: Sunday, April 11, 2004 8:23 PM
> Subject: Re: [PHP] creating log files out of a delete statement
>
>
>> Andy B wrote:
>>
>> > i have a section of a website that deletes records from a mysql
>> table...
>> > right now all the query is is a delete statement but i need to make a
> "log
>> > file" in this format:
>> > current time::username who executed delete:: deleted(name of
> record)::delete
>> > completed
>> > or delete failed depending on what happened... i can do all of the log
>> > except dont exactly know how to extract the "Name" field of the
>> deleted
>> > record before it actually gets dumped.. that way i can use it on the
> log...
>>
>> There's no way to extract it from the DELETE. You'll have to do a SELECT
>> with the same parameters that you're going to do the DELETE with. Grab
>> your data with the SELECT then execute the DELETE.
>>
>> --
>> ---John Holmes...
>>
>> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>>
>> php|architect: The Magazine for PHP Professionals www.phparch.com
>>
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>