Judul
<<< First << Prev 1 Next >> Last >>>
Judul
File gambar
image_gallery.php
<?php
include('includes/header.php');
include('includes/koneksi.php');
$imgDt = isset($_POST['imgDt']) ? $_POST['imgDt'] : '';
//Save File
if (isset($_REQUEST['save'])){
if (empty($_FILES['uploaded_file'])){
echo "Tidak ada file yang diupload.";
}else{
$title = mysql_real_escape_string($_REQUEST['title']);
//$uploadPath = uploadPicture("uploaded_file");
$uploadPath = $_FILES['uploaded_file'];
$sqlstr = "INSERT INTO image_gallery(title, path) ";
$sqlstr .= "VALUES('".$title."','".$uploadPath."')";
$result = mysql_query($sqlstr) or die(mysql_error());
$confirmation = ($result)? "Gambar telah tersimpan." : "Gagal menyimpan data.";
}
}
$limit = 25;
//Get total records
$resTotal = mysql_query("SELECT COUNT(id) AS total FROM image_gallery") or die(mysql_error());
$data = mysql_fetch_object($resTotal);
$totalRec = $data->total;
//Get total pages
$totalpaging = ceil($totalRec / $limit);
$paging = (!empty($_REQUEST['paging']) && $_REQUEST['paging'] != 0)? $_REQUEST['paging'] : 1 ;
//Set record position
if (empty($paging) || $paging ==0) {
$position = 0;
$paging=1;
}
else
$position = ($paging -1 ) * $limit;
$result = mysql_query("SELECT * FROM image_gallery LIMIT $position, $limit") or die(mysql_error());
$numRows = (mysql_num_rows($result) > $limit)? 20 : mysql_num_rows($result) ;
if ($numRows > 0){
?>
<div align="center">
<div style="width:700px;text-align:left;padding-top:25px;">
<?php
echo $confirmation;
?>
Notice: Undefined variable: confirmation in C:\xampp\htdocs\php_template2\image_gallery.php on line 53
Line 53 is: <?php
echo $confirmation;
?>
Also, when I checked image_gallery table:
path title id
Array Judul 0
Why the path Array? I cannot see the picture that I uploaded.