Re: delete and recreate

From: Date: Wed, 09 Nov 2011 16:31:36 +0000
Subject: Re: delete and recreate
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-315616@lists.php.net to get a copy of this message
On 9 Nov 2011, at 15:35, Kirk Bailey wrote: > So, I want to create a script to delete an old file and create a new one which is empty. The > script receives a password via query string. The obvious methods give me back a very useless 500 > error. Any suggestions on how to accomplish what I seek? First of all you need to sort out your development environment. Getting a 500 response from the server suggests that your server is set up to hide PHP error messages from you. Are you, perchance, using Windows? I don't know what you need to tweak to get it to show you PHP errors but others here may be able to help you with that. As far as your task goes it seems pretty straightforward. Use unlink() to delete the existing file if file_exists() returns true, then use touch() to create the new, empty file. Simples. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/

« previous php.general (#315616) next »