hi all,
i had a table 'files'. in which fileid,filename,uploadeddate,uploadedby,size are columns. now i need to display the occupied space under the table. means i hav to sum all the values in size. i had done it on line 38. but wat i need is tat sum value i should display under the table files.so please help me.

<html>
<body>
<form enctype="multipart/form-data" action="upload2.php" method="POST">
<table>
<tr>
<td><img src="Logofinalcopy.gif"></td>
</tr>
</table>
<table>
<?php echo "<left> <br> <input type='button' value='back' onClick='history.go(-1)'></left>";?> 
<br><br>

<tr>
	<td>
		<strong>Please choose a file: </strong>
	</td> 
	<td>
		<input name="uploaded" type="file"><br>
    </td>
</tr>
<tr><td>
<input type="submit" value="upload"></td></tr>
</table></form></body></html>
<?php
ob_start();
@session_start();
require_once ("check.php");
$con=mysql_connect("10.70.1.50","invensis","invensis");
if(!$con)
    {
             die('Could not connect: ' . mysql_error());
    }
mysql_select_db("database_myproject",$con); 
 $sql= "select * from files where uploadedby='$_SESSION[username]'";
 mysql_error();
    $result=mysql_query($sql);
    $num=mysql_num_rows($result); 
 $sql1="select sum(size) from files";
    mysql_error();
    $data=mysql_query($sql1);
    
   ?>
<html>
<body>
<table border="1" cellspacing="0" cellpadding="0" align="center" style="width: 500px">
<tr>
<th></th>
<th>filename</th>
<th>uploadedby</th>
<th>uploadeddate(Y-M-D)</th>
<th>size(in KB)</th>
</tr>
 <?php
             $i=0;
while ($i < $num) {

$f1=mysql_result($result,$i,"filename");
$f2=mysql_result($result,$i,"uploadedby");
$f3=mysql_result($result,$i,"uploadeddate");
$f4=mysql_result($result,$i,"size");


?>
 <tr>
 <td><a href =http://localhost/Project/upload.php onclick="window.open('http://localhost/Project/download.php?f1=<?php echo $f1;?>','popup','width=550,height=400,scrollbars=no,resizable=no,toolbar=no,directories=no,location=center,menubar=no,status=no,left=370,center=0,top=300')">
    download</a></td>
 <td><?php echo $f1;?></td> 
<td><?php echo $f2; ?></td>
<td><?php echo $f3;?></td>
<td><?php echo $f4; ?> </td></tr>
 
<?php
    $i++;
    }
    
?>

</table></body></html>

I have no idea what you're asking.. but the following code will extract every row of data from your table.

It will display each value for title, file, and date and then go to the next row and continue until there are no more rows left. If that's not what you want.. be more clear with your problem.

$result = mysql_query("SELECT * FROM files");

while($row = mysql_fetch_assoc($result)){
			$title = $row['title'];
			$files = $row['files'];
			$date = $row['date'];
echo $title;
echo $files;
echo $date;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.