I am trying to display a gif file that I've successfully stored up to mysql. I have 3 short files that all work to gether to accomplish this task. 1. get_image.html (no problems w/this one) 2. get_image.php (I think this one is fine too) 3. crostchair.php (this one has the problem) It is with the 3rd file where the problem exists. Here is a clip from that file: ----------------------------------------------------- $sql = "SELECT furn_pic"; $sql .= "FROM crost"; $sql .= "WHERE item_num = $item_num"; $result = mysql_query($sql)or die("Couldn't get file list"); --------------------------------------------------------- At first, I had to rem out my initial 3 lines of code to even get as far as I did, or I'd get "invalid modelID specified" -------------------------------------------------------- <?php #global $item_num; #if(!is_numeric($item_num)) #die("Invalid modelId specified"); ------------------------------------------------------- In my db table, item_num is an AUTO_INCREMENT primary key. --------------------------------------------------------- Here is code for get_image.php: ------------------------------------------------------- <?php /*----------------------------------------------------start of database connection/selection------------------------------*/ $link = mysql_pconnect( "localhost", "", "" ); if ( ! $link ) { $dberror = mysql_error(); return false; }else { print "<h2>Successfully connected to server</h2>\n\n"; } if ( ! mysql_select_db( "myfiles", $link ) ) { $dberror = mysql_error(); return false; } mysql_select_db("myfiles"); $dbQuery = "SELECT item_num, model_id, furn_name "; $dbQuery .= "FROM crost "; $dbQuery .= "ORDER BY model_id ASC"; $result = mysql_query($dbQuery) or die("Couldn't get file list"); ?> <!------------------------------------------end of database connection/selection------------------------------------------> <!------------------------------------------start of HTML column headings------------------------------------------> <table border="1" cellpadding="0" cellspacing="0" bordercolor="#111111" width="100%"> <tr> <td width="34%" bgcolor="#FF9900" height="21"> <p style="margin-left: 10"><b><font size="2" face="Verdana" color="#FFFFFF"> Model ID</font></b></td> <td width="33%" bgcolor="#FF9900" height="21"> <p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF"> Furniture name</font></b></td> <td width="33%" bgcolor="#FF9900" height="21"> <p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF"> File</font></b></td> </tr> <!------------------------------------------end of HTML column headings------------------------------------------> <!-------------start of HTML table that inludes ID, name and pic of each piece of furniture ------------------------------------------> <?php //As mentioned above, we will be displaying each file as a table row. The HTML code above creates this table. while($row = mysql_fetch_array($result)) { ?> <tr> <td width="34%" bgcolor="#FFDCA8" height="21"> <p style="margin-left: 10; margin-right: 10"> <font face="Verdana" size="1"> <?php echo $row["model_id"]; ?> </font> </td> <td width="33%" bgcolor="#FFDCA8" height="21"> <p style="margin-left: 10"> <font face="Verdana" size="1"> <?php echo $row["furn_name"]; ?> </font> </td> <td width="33%" bgcolor="#FFDCA8" height="21"> <p style="margin-left: 10"><font face="Verdana" size="1"> <a href="crostchair.php?fileId=<?php echo $row["item_num"]; ?>"> Download now </a></font> </td> </tr> <?php } echo "</table>"; ?> --------------------------------------------------------- here is code for crostchair.php --------------------------------------------------------- <?php #global $item_num; #if(!is_numeric($item_num)) #die("Invalid modelId specified"); /*----------------------------------------------------start of database connection/selection------------------------------*/ $link = mysql_pconnect( "localhost", "", "" ); if ( ! $link ) { $dberror = mysql_error(); return false; }else { print "<h2>Successfully connected to server</h2>\n\n"; } if ( ! mysql_select_db( "myfiles", $link ) ) { $dberror = mysql_error(); return false; } $sql = "SELECT furn_pic"; $sql .= "FROM crost"; $sql .= "WHERE item_num = $item_num"; $result = mysql_query($sql)or die("Couldn't get file list"); if(mysql_num_rows($result) == 1) /*-----if row returned from our query, we save its actual data to a variable, $fileContent.----------------------------------------------*/ { $fileContent = @mysql_result($result, 0, "furn_pic"); header("Content-type: $fileType"); echo $fileContent; } else { echo "Record doesn't exist."; } ?> Any ideas? ===== Patrick Roane Web design and development www.franklin-band.com Fox River Grove, Il. -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php