if(count($_FILES['upload']['name']) > 0){
//Loop through each file
for($i=0; $i<count($_FILES['upload']['name']); $i++) {
//Get the temp file path
$tmpFilePath = $_FILES['upload']['tmp_name'][$i];
//Make sure we have a filepath
if($tmpFilePath != ""){
//save the filename
$shortname = $_FILES['upload']['name'][$i];
//save the url and the file
$filePath = "../img/slider/" .$_FILES['upload']['name'][$i];
//Upload the file into the temp dir
if(move_uploaded_file($tmpFilePath, $filePath)) { $files[] = $shortname;
}
}
}
}
if(is_array($files)){
foreach($files as $file){
$file1 = "img/slider/" . $file;
$query = "INSERT INTO image(image_path,p_number)VALUES('$file1','$number')";
$result3 = $db->insert($query);
}
}
How can I add implode? to store in my database as a 1 record only. because this is generating record each of file my file upload.
the first image is my current database look like. and the second is my goal. how can I do that?