I can read from files that are uploaded but now I would like to INSERT the data entered on the file to be inserted to mysql database. But not sure how this work. Tried to search few term and I have tested few methods. Nothing works.
<?php
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else
{
//echo "Upload: " . $_FILES["file"]["name"] . "<br />";
//echo "Type: " . $_FILES["file"]["type"] . "<br />";
//echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
//echo "Stored in: " . $_FILES["file"]["tmp_name"];
}
$filename = $_FILES["file"]["tmp_name"];
LOAD DATA INFILE $filename
INTO INTO TABLE test
(Que_Question, Que_Choice1, Que_Choice2, Que_Choice3, Que_Choice4, Que_Answer1, Que_Answer2, Que_Answer3, Que_Answer4)
$fd = fopen ($filename, "r");
$contents = fread ($fd,filesize ($filename));
fclose ($fd);
$delimiter = ".";
$splitcontents = explode($delimiter, $contents);
foreach ( $splitcontents as $color )
{
echo "<b> $color<br>";
}
?>