I'm trying to receive data from a mysql database through php.

Using the command line at mysql listed below gives me a result set.

I am able to connect to the database through php, however, when using the
following script, I receive no data when the data is in the table called
pictures in the db called sitename.

<?
if($ID) {
@MYSQL_CONNECT("localhost","root","thepassword");
@mysql_select_db("sitename");
$query = "select bin_data,filetype from pictures where ID=$ID";
$result = @MYSQL_QUERY($query);
$data = @MYSQL_RESULT($result,0,"bin_data");
$type = @MYSQL_RESULT($result,0,"filetype");
Header( "Content-type: $type");
echo $data;
}
?>

// In browser window it reads:
// http://localhost/download.php?filename=7

//...and on the Command Line using the following query:
// SELECT filetype FROM pictures where ID=$ID
// gives me a image/pjpeg as the result set.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to