Retrieving Binary Data and Displaying

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

If you have access to your php.ini then turn both magic_quotes_gpc and magic_quotes_runtime Off and restart the webserver. If not you could use a .htaccess
php_value magic_quotes_gpc 0
php_value magic_quotes_runtime 0
WelshApple
Forum Newbie
Posts: 9
Joined: Fri May 21, 2004 12:07 pm
Location: Wales-UK

Post by WelshApple »

WaldoMonster wrote:Now it must be working.

Code: Select all

<?php
$link = mysql_connect('localhost', 'USERNAME', 'PASSWORD'); 
mysql_select_db('DATABASE'); 
$query = "SELECT image FROM test WHERE id='1'"; 
$result = mysql_query($query); // removed $link 
header('Content-type: image/jpeg'); 
list($data) = mysql_fetch_row($result); 
print $data;
mysql_close($link); // close connection
?>
It is also posible to use mysql_pconnect() instead of mysql_connect().
Then you don't have to close the connection.
Yey :-) That's the ticket!

Thanks a million!
User avatar
WaldoMonster
Forum Contributor
Posts: 225
Joined: Mon Apr 19, 2004 6:19 pm
Contact:

Post by WaldoMonster »

I hope it is still working.
You have replayed before I finessed editing.
Take a look back if this is also working. :roll:
WelshApple wrote:
WaldoMonster wrote:Now it must be working.

Code: Select all

<?php
$link = mysql_connect('localhost', 'USERNAME', 'PASSWORD'); 
mysql_select_db('DATABASE'); 
$query = "SELECT image FROM test WHERE id='1'"; 
$result = mysql_query($query); // removed $link 
header('Content-type: image/jpeg'); 
list($data) = mysql_fetch_row($result); 
print $data;
mysql_close($link); // close connection
?>
It is also posible to use mysql_pconnect() instead of mysql_connect().
Then you don't have to close the connection.
Yey :-) That's the ticket!

Thanks a million!
Post Reply