必須說我下載數據庫和我的所有功能都在課堂上。刪除功能並上傳
這就是我是難以置信的高興作用,認爲他們是不錯..
這就是我該怎麼去建立地方,如果它與id_session適合上傳到該網站的ID的畫廊是日誌在頁面中,您可以選擇刪除它。所以它必須返回到最新的圖片/當它從文件夾和數據庫中刪除時。但它會出現一個錯誤,你可以在這裏看到;
致命錯誤:調用一個成員函數bind_param()非對象上在/ home/jesperbo /的public_html/mebe.dk /功能/上線function.php 411
它是這樣的,我也在建立一個上傳系統的過程中,底層數據庫並在我現在設置它的時候使它變小,當它做了兩件事情時,必須把我發回到/ latest-images /,但是它沒有達到唯一可用的圖片在服務器上運行,並與圖片一起完成,但不會以某種方式返回。所以到/最新的圖像/
哪裏錯了,刪除等我躺在只是在這裏,
$stm1->bind_param('i', $id_gallery);
function img_slet_indhold(){
if($_SESSION["logged_in"] = true && $_SESSION["rank"] == '1' || $_SESSION["rank"] == 2)
{
if($stmt = $this->mysqli->prepare('SELECT `title` FROM `gallery` WHERE `id_gallery` = ?'))
{
$stm1->bind_param('i', $id_gallery);
$id_gallery = $_GET["id_gallery"];
$stm1->execute();
$stm1->store_result();
$stm1->bind_result($title);
$UploadDir = "/gallery/";
//ligger i toppen af documentet, evt som en define
if($stm1->fetch())
{
$tmpfile = $UploadDir . "" . $title;
if(file_exists($tmpfile))
{
unlink($tmpfile);
}
$tmpfile = $UploadDir . "lille/" . $title;
if(file_exists($tmpfile))
{
unlink($tmpfile);
}
$tmpfile = $UploadDir . "store/" . $title;
if(file_exists($tmpfile))
{
unlink($tmpfile);
}
}
$stm1->close();
}
else
{
/* Der er opstået en fejl */
echo 'Der opstod en fejl i erklæringen: ' . $mysqli->error;
}
}
if($stmt = $this->mysqli->prepare('DELETE FROM `gallery` WHERE `id_gallery` = ?'))
{
$stmt->bind_param('i', $id);
$id = $_GET["id_gallery"];
$stmt->execute();
header('Location: /nyeste-billeder/');
$stmt->close();
}
else
{
/* Der er opstået en fejl */
echo 'Der opstod en fejl i erklæringen: ' . $mysqli->error;
}
}
所以到,因爲它應該從刪除的文件,我選擇了這樣在這裏做;
<?php
session_start();
require_once ("function/function.php");
$mebe = new mebe;
$db = $mebe->db_c();
error_reporting(E_ERROR);
$img_slet_indhold = $mebe->img_slet_indhold();
?>
所以,當我上傳圖片到文件夾和數據庫中,並可以返回後上傳
function img_indhold(){
if($_SESSION["logged_in"] = true && $_SESSION["rank"] == '1' || $_SESSION["rank"] == 2)
{
include "function/class.upload.php";
$handle = new Upload($_FILES["filename"]);
if($handle->uploaded)
{
//lidt mere store billeder
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_x = 220;
$handle->Process("gallery/store");
//til profil billede lign..
$handle->image_resize = true;
$handle->image_ratio_crop = true;
$handle->image_y = 115;
$handle->image_x = 100;
$handle->Process("gallery");
//til profil billede lign..
$handle->image_resize = true;
$handle->image_ratio_crop = true;
$handle->image_y = 75;
$handle->image_x = 75;
$handle->Process("gallery/lille");
$pb = $handle->file_dst_name;
}
if($stmt = $this->mysqli->prepare('INSERT INTO `gallery` (`title`, `id_bruger`) VALUES (?, ?)'))
{
$stmt->bind_param('si', $title, $id_bruger);
$title = $pb;
$id_bruger = $_SESSION["id"];
$stmt->execute();
header('Location: /nyeste-billeder/');
$stmt->close();
}
}
}
當所以,當我把它在頁面上時,需要它這樣做不喜歡它這個;
<?php
session_start();
require_once ("function/function.php");
$mebe = new mebe;
$db = $mebe->db_c();
error_reporting(E_ERROR);
$img_slet_indhold = $mebe->img_slet_indhold();
?>
它是在這裏爲我將上傳到網站,並顯示在頁面
function vise_img(){
if ($stmt = $this->mysqli->prepare('SELECT `id_gallery`, `title`, `id_bruger` FROM `gallery` ORDER BY `gallery`.`id_gallery` DESC')) {
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($id_gallery, $title, $id_bruger);
while ($stmt->fetch()) {
echo "<div id=\"gallery_box\">";
echo "<a href=\"/profil/$id_bruger/\"><img src=\"/gallery/$title\" alt=\"\" height=\"115\" width=\"100\" border=\"0\"></a>";
if($_SESSION["logged_in"])
{
if($id_bruger == $_SESSION["id"])
{
echo "<ul>";
echo "<li><a href=\"/nyeste-billeder-slet/$id_gallery/\">Slet</a></li>";
echo "</ul>";
}
}
echo "</div>";
}
/* Luk statement */
$stmt->close();
} else {
/* Der er opstået en fejl */
echo 'Der opstod en fejl i erklæringen: ' . $mysqli->error;
}
}
function upload_img(){
if($_SESSION["logged_in"] = true && $_SESSION["rank"] == '1' || $_SESSION["rank"] == 2)
{
?>
<form name="opslag" method="post" action="/nyeste-ok/" enctype="multipart/form-data">
<input type="file" name="filename" id="filename" onchange="checkFileExt(this)">
<input name="upload" value="Upload" id="background_indhold" onclick="return check()" type="submit">
</form>
<?php
}
elseif ($_SESSION["logged_in"] != true && $_SESSION["rank"] != '1' || $_SESSION["rank"] != 2)
{
echo "<p>Du har ingen mulighed for at upload billeder på siden</p>";
}
}
真的希望你能夠幫我在畫廊/圖片!
代碼太多。我在閱讀問題時迷路了。 'function.php'的第411行在哪裏? – Jocelyn
這就是我已經清楚的問題,因爲伊恩香農幫助我回答最後的答案,但現在我只需要找出爲什麼它不會從文件夾和數據庫中刪除,並且只是將它發回給我。當我上傳一張圖片來打擾這個圖像,並模仿成數據庫和文件夾時,它只是沒有打擾我回到頁面。如果你能跟着我,否則問我。 –