---
title: "databasen uppdateras inte"
type: "forum-thread"
url: "https://www.webforum.nu/amne/php/67684-databasen-uppdateras-inte"
topic: "PHP"
topic_url: "https://www.webforum.nu/amne/php"
author: "Niehls"
published: "2003-02-09T14:10:39.000Z"
updated: "2003-02-09T14:10:39.000Z"
replies: 0
views: 149
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/php/67684-databasen-uppdateras-inte"
---

# databasen uppdateras inte

## #1 — Niehls, 2003-02-09T14:10Z

jag har fixat ett enkelt enkelt kösystem för nedladdning.
kontentan är följande:

```php
		if (file_exists($fullpath)) 
			{ 
			//header("Content-type: application/zip"); 
			// might need the above... left it in here for future possible use - 
			// although the line below worked with zips
			header("Content-type: application/octet-stream");
			header("Content-Disposition: attachment; filename=\"$p\""); 
			header("Content-Transfer-Encoding: binary"); 
			header("Content-length: ".(string)($file_size)); 
				if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE'))
				{ 
				// IE cannot download from sessions without a cache 
				header('Cache-Control: public'); 
				} 
			mysql_query("update downloads set active='1' , place_in_line='0' where download_id=$_GET[download_id]'");
			
			
				readfile($fullpath);
				
						mysql_query("update downloads set active='0' where download_id='$_GET[download_id]'");
				
			
			mysql_close();
			} 
			else 
			{ 
			print "not found"; 
			die(); 
			}
```

problemet är att efter readfile($fullpath) så uppdateras databasen \*ibland\*. detta verkar ske ganska slumpmässigt. 
även vid:

```php
if(readfile($fullpath))
{
    mysql_grejs_grejs();
}
```

så fungerar det ungefär lika.

nån som vet hur man kan utföra ett kommando när hela filen laddats ner?

Permalänk: https://www.webforum.nu/p/67684

---

Tråden på webben: https://www.webforum.nu/amne/php/67684-databasen-uppdateras-inte
