WHOHOO! I figured it out. The problem was in the way I have the values initially set up in the database. Whenever the user clicks the confirmation link in an e-mail, it automatically adds an instance in the binary_data table w/ their the user's uname, auto-increments id, and assigns the value "" for all the remaining fields. This was the problem, since in my add function I specified the "" value to be added to the database for the filename field, it did not insert the "default image" value I had intended it to. I simply changed the
if ($filename=='default image') {
to
if ($filename=='') {
and the code works like a charm now!!! 😃
If anybody else was interested in doing something similar to this, the code is now:
<?php
// getdata.php3 - by Florian Dittmer <dittmer@gmx.net>
// Example php script to demonstrate the direct passing of binary data
// to the user. More infos at http://www.phpbuilder.com
// Syntax: getdata.php3?id=<id>
if($id) {
@MYSQL_CONNECT("host","user","password");
@mysql_select_db("databasename");
$query = "select bin_data,filetype,filename from binary_data where id=$id";
$result = @($query);
if (mysql_num_rows($result)>0) {
list ($data,$type,$filename)=mysql_fetch_row($result);
if ($filename=='') {
header( "Content-type: img/gif");
$fp = fopen('noimage.gif', 'rb');
fpassthru($fp);
exit;
} else {
header( "Content-type: $type");
echo $data;
exit;
}
}
}
?>
to call the image from an html or php document located in the same directory as the "getdata.php3" file, simply use the same img tag and url that was specified by Florian Dittmer's article located (http://www.phpbuilder.com/columns/f...mp;print_mode=1):
<img src="getdata.php3?id=<id>">
Thank you very much cahva!!!! Couldn't have done it without you. Well maybe, but I surely would have vowed to never program again, probably been bald, and very bitter at age 23. J/k
Thanks again, greatly appreciated. Hope this helps somebody else.