Re: Re: Amount of data in the database

From: Date: Tue, 14 Jan 2003 14:12:08 +0000
Subject: Re: Re: Amount of data in the database
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-131548@lists.php.net to get a copy of this message
Hello again! Basically...you can't. What I meant was that when you insert the data into the table, you need to store the size as well. Consider the following table (called files): dataID user filename size filedata [int, autoincremented] [int] [varchar] [int] [blob] Now, let's say user 3 uploads the file 'airplane.jpg' to the server. We need to have the following information: $filename = The name of the file $filedata = The actual file $size = The size of the uploaded file You can find out about how to get these variables from http://www.php.net/manual/en/features.file-upload.php Then you insert the data into your table; "INSERT INTO files(user, filename, size, filedata) VALUES (3, $filename, $size, $filedata)" This means that every time some user upload a file, the size of the file will be tied to a particular record. Then you just use MySQLs built-in SUM function to find out the total amount of data (check my previous post) Kindly /Lars Olsson (lasso@lassoweb.nu) Denis L. Menezes wrote:
Thanks Lars. Sorry, then I have another question. How do I find the size of the record? Thanks Denis


« previous php.general (#131548) next »