Below is a page which is supposed to output the name, blog contribution and picture of contributing members of a website.
[php][php]
".$row['title']."
"; echo "" .$row['entry']."
".$row['firstname']."
Query was not successful because:".mysql_error()."
"; echo "The query being run was \"".$sql."\"
"; } else if($query !== false && mysql_num_rows($query) == 0) { echo "The query returned 0 results.
"; } mysql_close(); //Close the database connection. ?> </div> <!-- closes blog content-->[/php][/php]
The select query is designed to retrieve all the blog contributions(represented by the fields blogs.title and blogs.entry) from the database, alongside the contributing member (member.firstname) and the member’s picture(images.image), using the member_id column to join the 3 tables involved, and outputs them on the webpage. The title, entry and firstname values are successfully displayed on the resulting page. However, I can’t seem to figure out how to get the picture to be displayed. Note that the picture was successfully stored in the database and I was able to view it on a separate page using a simple select query. It is now just a question of how to get it to display on this particularly crowded page. Anyone knows how I can output the picture in the img tag? I tried placing the header(“Content-type: image/jpeg”); statement at the top of the php segment, then just right below the select query and finally just right above the img tag, but in every case, I just got a big white blank page starring at me. How and where should I place the header statement? And what else am I to do to get this picture displayed? Any help is appreciated.