Jump to content

image database display problem

- - - - -

  • Please log in to reply
2 replies to this topic

#1
mutago

mutago

    Programmer

  • Members
  • PipPipPipPip
  • 102 posts
Good day everyone, i need to display image from the database but the code returns error page when i tried to print image from the database using


   

      print fout




below is the entire codes



   

      #! /data/python

   

      import MySQLdb

   

      import sys

   

       

   

       [

   

      print ("Content-type: image/jpeg");

   

      print # End of headers!

   

       

   

      try:

  

      cx = (*********)

 

       

  

      cursor = cx.cursor()

 

       

  

      cursor.execute("SELECT photo FROM picture LIMIT 1")

  

       

  

      fout=cursor.fetchone()[0]

 

      print fout

 

       

  

      #fout.close()

  

       

  

      #cursor.close()

  

      cx.close()

  

       

  

   except IOError, e:

  

      print "Error %d: %s" % (e.args[0],e.args[1])

 

      sys.exit(1)

ANY HELP

#2
brooks

brooks

    Newbie

  • Members
  • Pip
  • 3 posts
What type of error are you getting?

#3
mutago

mutago

    Programmer

  • Members
  • PipPipPipPip
  • 102 posts
it prints empty page




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users