image src is not displaying the page in php -


**i'm trying upload img path in database , show them in slider, problem img src not showing page assigned. can body tell me why image src not loading page.

my code below
slider.php slider has image code

:<img src='<?php echo "imagetest.php?id=$id" ?> width="200"> image path couldn't display page

imagetest.php has following code:

page not showing in img src of slider

if (empty($_get['id']) || !is_numeric($_get['id'])) { echo 'a valid image file id required display image file.'; exit; }

$imageid = $_get['id'];  //connect mysql database if ($conn = mysqli_connect('localhost', 'root', 'root', 'test')) {     $content = mysqli_real_escape_string($conn, $content);     $sql = "select type, content images id = {$imageid}";      if ($rs = mysqli_query($conn, $sql)) {         $imagedata = mysqli_fetch_array($rs, mysqli_assoc);         mysqli_free_result($rs);     } else {         echo "error: not data mysql database. please try again.";     }     //close mysqli connection     mysqli_close($conn);  } else {     echo "error: not connect mysql database. please try again."; }     if (!empty($imagedata)) {     // show image.     header("content-type: {$imagedata['type']}");     echo $imagedata['content']; } 

?>

use file_get_contents

<img src="<?php echo file_get_contents('imagetest.php?id='. $id);?>" width="200"/> 

and remove header(), u don't need it.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -