I got a forum which you can post a title and description to it. So I got this database at the moment:
Now I want to be able to add an image to my post. I got a file upload page which I got from:
http://bytes.com/topic/php/insights/740327-uploading-files-into-mysql-database-using-php
Which I could use. But it wont make me see the image. Just the information of the image and the option to download it. It looks like this:
After I post my post, I want to be able to just see the image when I look at my post. I think there must be a different way to do this, right?
EDIT: My post php code:
<?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>';
}
}
?>
I know about the sql injection...