Guest User

Untitled

a guest
Jun 19th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. <?php
  2. $npic= $_POST['picnum'];
  3. $id =$npic;
  4. //$id= 2;
  5. //$a = 1;
  6. $username = "root";
  7. $password = "";
  8. $host = "localhost";
  9. $database = "test";
  10.  
  11. @mysql_connect($host, $username, $password) or die("Can not connect to database: ".mysql_error());
  12.  
  13. @mysql_select_db($database) or die("Can not select the database: ".mysql_error());
  14.  
  15.  
  16.  
  17. if(!isset($id) || empty($id)){
  18. die("Please select your image!");
  19. }else{
  20.  
  21. $query = mysql_query("SELECT image FROM tbl_images ");
  22. $row = mysql_fetch_array($query);
  23. $content = $row[2];
  24.  
  25. header("Content-type: image/jpg");
  26. echo $content;
  27.  
  28. }
  29.  
  30. ?>
Add Comment
Please, Sign In to add comment