我有一個論壇,你可以發佈標題和說明。所以我在此刻得到這個數據庫:讓人上傳圖片到帖子
現在我希望能夠將圖像添加到我的職務。我有一個文件上傳頁面,我從: http://bytes.com/topic/php/insights/740327-uploading-files-into-mysql-database-using-php 我可以使用。但它不會讓我看到圖像。只是圖像的信息和下載它的選項。它看起來像這樣:
當我發佈我的帖子後,我希望能夠看到我的帖子時看到圖像。我認爲必須有不同的方式來做到這一點,對吧?
編輯: 我交的PHP代碼:
<?php
session_start();
$mysqli = new mysqli("localhost", "root", "usbw", "accounts");
$mysqli2 = new mysqli("localhost", "root", "usbw", "forum");
$alles_goed=false;
if(isset($_SESSION['username'])){
$usernamecheck = $mysqli->query("SELECT * from account_information where username ='". $_SESSION['username'] ."'");
if (isset($_POST['title'])) {
$alles_goed=true;
$description=$mysqli2->real_escape_string($_POST['description']);
$title=$mysqli2->real_escape_string($_POST['title']);
$usernameinsert=$mysqli2->real_escape_string($_SESSION['username']);
if($usernamecheck->num_rows==0){
$alles_goed=false;
}
if($alles_goed==true){
echo'<a href="questionprogramming.php">Back to programming</a>';
$a=date("Y-m-d H:i:s");
$resultaat = $mysqli2->query("INSERT INTO questions (title, description, username, date_made) VALUES ('" . $title . "','" . $description . "', '".$usernameinsert."','".$a."')");
}
}
if($alles_goed==false){
echo'<table>';
echo
<<<EOT
<form action="newquestion.php" method="post">
<tr><th><td><input type="text" size="108%" name="title"></td></tr></th>
<tr><th><td> <textarea name="description" rows="20" cols="80" ></textarea></td></tr></th>
<tr><th><td><input name="submit" type="submit" value="submit"></td></tr></th>
</form>
EOT;
echo'</table>';
}
}
?>
我知道SQL注入...
你能告訴我們你的代碼嗎? HTML/PHP等。另外..是那漫畫無ms:P –
你awnser是probally overhere http://stackoverflow.com/questions/7793009/how-to-retrieve-images-from-mysql-database-and-display -in-an-html-tag – Alex
@ 1ntello老實說,我不知道我應該把代碼放到什麼地方,甚至要提供一些關於此事的額外信息。我只是不知道如何去做我所要求的。是的。 – Loko