SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | if (isset($_POST['bts'])){
| |
| 3 | $nama_foto=$_FILES['foto']['name']; | |
| 4 | // Simpan ke Database | |
| 5 | - | $data = mysqli_query($con,"insert into slider values ('".$_POST['judul']."','".$_POST['keterangan']."','$nama_foto')");
|
| 5 | + | /* |
| 6 | - | |
| 6 | + | tulis dgn lengkap fieldnya jgn langsung tembak |
| 7 | */ | |
| 8 | - | move_uploaded_file($_FILES['foto']['tmp_name'], "images/".$_FILES['foto']['name']); |
| 8 | + | $sql="insert into slider |
| 9 | - | |
| 9 | + | (judul, keterangan, nama_foto) |
| 10 | - | if ($data) {
|
| 10 | + | values |
| 11 | - | echo "<div class='alert alert-success' role='alert'><span class='glyphicon glyphicon-ok-circle'></span> Data Berhasil disimpan</div>"; |
| 11 | + | ('".$_POST['judul']."','".$_POST['keterangan']."','$nama_foto')";
|
| 12 | $query = mysqli_query($con,$sql); | |
| 13 | - | echo "<div class='alert alert-danger' role='alert'><span class='glyphicon glyphicon-remove-circle'></span> Gagal!</div>"; |
| 13 | + | /* |
| 14 | jgn proses sebelum yakin querynya masuk | |
| 15 | */ | |
| 16 | if($query){
| |
| 17 | // Simpan di Folder Gambar | |
| 18 | copy($_FILES['foto']['tmp_name'], "images/".$_FILES['foto']['name']); | |
| 19 | }else{}
| |
| 20 | ||
| 21 | if ($query) {
| |
| 22 | echo "<div class='alert alert-success' role='alert'><span class='glyphicon glyphicon-ok-circle'></span> Data Berhasil disimpan</div>"; | |
| 23 | } else {
| |
| 24 | echo "<div class='alert alert-danger' role='alert'><span class='glyphicon glyphicon-remove-circle'></span> Gagal!</div>".mysqli_error(); | |
| 25 | } | |
| 26 | mysqli_close($con); | |
| 27 | } | |
| 28 | ?> |