I have been able to upload images into a database but now i would also like to display the uploaded image just below the html form. I am trying to do this by creating an array in a php script that will be used in a separate php script. the error dispalyed is this " Do not access super global $_REQUEST directly" How can i solve this?
<?php
require 'connection';
$id = addslashes ($_REQUEST ['id']);
$image = mysql_query ("SELECT * FROM players WHERE id= $id");
$image2 = mysql_fetch_assoc($image);
$image3 = $image2 ['image'];
header ("content-type: image/jpeg");
echo $image3;
<?php
require 'connection.php';
// file properties
$id = filter_input(INPUT_POST, 'playerid');
$name = filter_input(INPUT_POST, 'name');
$age = filter_input(INPUT_POST, 'age');
$position = filter_input(INPUT_POST, 'position');
$nationality = filter_input(INPUT_POST, 'nationality');
$file = $_FILES['image']['tmp_name'];
if (! isset($file)){
echo "Please select an image.";
}
else {
$_id = mysql_real_escape_string( $id );
$_name = mysql_real_escape_string( $name );
$_age = mysql_real_escape_string( $age );
$_position = mysql_real_escape_string( $position );
$_nationality = mysql_real_escape_string( $nationality );
$image = addslashes(file_get_contents($_FILES ['image']['tmp_name']));
$image_name = addslashes($_FILES ['image']['name']);
$image_size = getimagesize($_FILES ['image']['tmp_name']);
if ($image_size == FALSE){
echo "Thats not an image.";
}
else{
if(!$insert = mysql_query("INSERT INTO players VALUES ( '$_id', '$_name', '$_age', '$_position', '$_nationality', '$image_name', '$image' )" )){
echo "Problem uploading image.";
}
else
{
$lastid = mysql_insert_id();
echo "Profile photo uploaded.<p />Player photo:<p /><img src= getphoto.php?id=$lastid";
}
}
}