How to upload multiple image in one record database SQL?

<?php
	if (isset($_POST['submit']))
	{ //Open 1
		$tipe_file1	= $_FILES['file1']['type']; // Why are we doing this?
		$tipe_file2	= $_FILES['file2']['type']; // Also, if the files are meant to be doing the same thing
		$tipe_file3	= $_FILES['file3']['type']; // Probably should have just called the field 'image[]' or something
		$tipe_file4	= $_FILES['file4']['type']; // And used an array. But we'll roll with it.
		if ($tipe_file1 == "image/jpeg" || $tipe_file1 == "image/jpg"){ //$_FILES['file1']['type'] works here instead. But instead... [Open2]
	$aMyUploads = array();
	foreach ($_FILES as $aFile) { //Open3
             //Better yet, lets put the type check if HERE, and check $aFile['type'] instead.
		if(0 === $aFile['error']){ //Open4
		$newLocation = 'foto/'.$aFile['name'];
		if(0 === $aFile['error'] && (false !== move_uploaded_file($aFile['tmp_name'], $newLocation))){ //We did already check $aFile['error']. [Open5]
		$aMyUploads[] = $newLocation;
		} else {
		$aMyUploads[] = '';
		} //[Close5]
	}//Close4
}//Close3

    	print_r($aMyUploads); //I assume this looks 'right' to you at this point.
    mysql_query("INSERT INTO smamakudus (nss, npsn, nama_sekolah, jenis_sekolah, akreditasi, alamat, tlp, web, jmlguru, jmlsiswa, kecamatan, lat, lon, image1, image2, image3, image4,) VALUES
    (
    '".$_POST['nss']."',
    '".$_POST['npsn']."',
    '".$_POST['nama_sekolah']."',
    '".$_POST['jenis_sekolah']."',
    '".$_POST['akreditasi']."',
    '".$_POST['alamat']."',
    '".$_POST['tlp']."',
    '".$_POST['web']."',
    '".$_POST['jmlguru']."',
    '".$_POST['jmlsiswa']."',
    '".$_POST['kecamatan']."',
    '".$_POST['lat']."',
    '".$_POST['lon']."',
    '".$_POST['alamat']."', //This shouldnt be here.
    '".$aMyUploads[0]."',
    '".$aMyUploads[1]."',
    '".$aMyUploads[2]."',
    '".$aMyUploads[3]."',
    '".$aMyUploads[4]."',)") or die(mysql_error());; //Double Semicolon All the way cross the sky what does it mean?
//Also... you've got 5 entries for "$aMyUploads" here, but you only have 4 fields.
     echo "<script>alert('Successfully added')</script>";
    	}else{ 
            // This should be an abort sequence inside the foreach; instead of asserting that the file type is one of the two assert that if it is not-either of the two, throw a message and continue;
    		echo "<script>alert('Failed to add data! Images must be inputed at last one and filetype JPG/JPEG')</script>
    		<script>setTimeout(\"self.history.back();\",0000);</script>";
    		}//[Close2]
    }//[Close1]
    echo "</div>
    	</div>";
?>

MySQL should fail this query every time because the number of values provided (19) doesn’t match the number of field names (17).

Additional notes:

  1. Check into Normalizing your data.
  2. mysql_ is deprecated and being removed in PHP7. Consider strongly learning PDO instead, or at the very least, upgrading to mysqli_.