hi , i am new to php.
i had a problem. whenever i upload a file it should get inserted in the database. it is working fine. now i should display that in a table in the browser but whenever i upload a file all other files names are not cuming only that file name,size,uploadeddate,uploadedby are displaying many times. if i upload another file now its details are displaying many times. can any one help me please......
<html>
<body>
<form enctype="multipart/form-data" action="upload2.php" method="POST">
<table>
<tr>
<td><img src="Logofinalcopy.gif"></td>
</tr>
</table>
<table>
<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);
?>
<html>
<body>
<table border="1" cellspacing="0" cellpadding="0" align="center" style="width: 500px">
<tr>
<th>filename</th>
<th>uploadedby</th>
<th>uploadeddate</th>
<th>size</th>
</tr>
<?php
$sno=1;
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td><?php echo $filename;?></td>
<td><?php echo $username; ?></td>
<td><?php echo date("d-m-y");?></td>
<td><?php echo $size; ?> </td></tr>
<?php
$sno=$sno+1;
}
?>
</table></body></html>