Currently I am doing a project in php for uploading CSV file and to insert data into database. Before inserting the data I need to display the data in table format.
I used this code for uploading and inserting the data.
if (isset($_POST['submit']))
{
$name = $_POST['camname'];
if (is_uploaded_file($_FILES['filename']['tmp_name']))
{
echo "<h1>" . "File ". $_FILES['filename']['name'] ." uploaded successfully." . "</h1>";
}
Import uploaded file to Database
$handle = fopen($_FILES['filename']['tmp_name'], "r");
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE)
{
$import="INSERT into uploadmail(name,email) values('$name','$data[0]')";
mysql_query($import) or die(mysql_error());
}
fclose($handle);
}
This coding successfully inserts the data into database but I need to display the data in table format.so please give any suggestions.
THANKS IN ADVANCE.