Loading Image from mySQL table.

From: Date: Thu, 01 Jun 2000 19:53:39 +0000
Subject: Loading Image from mySQL table.
Groups: php.general 
Request: Send a blank email to php-general+get-856@lists.php.net to get a copy of this message
Hi folks, I've stroed an image in one of my database tables, however, whenever I attempt to view it, it shows me nothing as if the image field doesn't contain any image. It's really weird for me and I'm unable to figure out what could the problem be. Any help would be appreciated... Here's the code I'm using to view the image: --------------------------------------------------------------------------------------------- $result = sql_query( "SELECT Image FROM Customers"'); if ( sql_num_rows( $result) ) { $picture = sql_result( $result, 0, "Image" ); if( strtoupper( substr( $result, 0, 3 ) ) == "GIF" ) { header( "Content-type: image/gif" ); } else { header( "Content-type: image/jpeg" ); } echo $picture; } --------------------------------------------------------------------------------------------- BTW: I'm using mySQL/PHP/Apache/Win98. Regards, Ayman

« previous php.general (#856) next »