Jump to content

Image select query distorts page display


drayarms

Recommended Posts

I wrote the page below to display a member's area of a website.  The page is a mix of html and php code.  the first part of is a block of php, which authenticates the user and displays the header.  The middle part is a block of html which contains the bulk of the page.  Embedded in this block of html are two sections of php, the first of which is supposed to display a user uploaded picture, enclosed in div tags, and the second of which, prints out the user's first name, from the database.  The end of the script is a line of php that displays the footer.  Now the page displays correctly when the section of php that contains the select query for displaying the picture(starting line 104) is omitted.  But once I include that section, all i see is a blank page.  Why is that section of php problematic? What can be done to fix it?  Here is the data for the full page.  Thanks for any help.

 

 

 

 

<?php

//address error handling

ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);


//authenticate user
require('auth.php');


//define title
define('TITLE' , 'Members');


require ('header.html'); //need the header



   ?>













<div id="main" style="background-color: #FFFFFF; height:71%; width:101%; border:0px none none; margin:auto; "> <!-- --> 







               <div id="main_left" style="float:left; height:100%; width:20%; border:0px none none;"> <!--opens main left--> 


  

                     <div id="main_left_top" style="float:left; position:relative;bottom:5px;right:5px; height:31.25%; width:100%;  background-color: #FFFFFF; border:1px solid #c0c0c0; margin:1px;"> <!--opens main left top--> 

  
                               

                     </div> <!-- closes main left top--> 




                     <div id="main_left_center" style="float:left; background-color: #FFFFFF; height:33%; width:100%; border-color:#a0a0a0;border-style:outset;border-width:1px; margin:auto; "> <!--opens the white content area--> 

  


                     </div> <!-- closes main left center--> 




                     <div id="main_left_bottom" style="float:left; background-color: #FFFFFF; height:33%; width:100%; border-color:#a0a0a0;border-style:outset;border-width:1px; margin:auto; "> <!--opens the white content area--> 

  


                     </div> <!-- closes main left bottom--> 





               </div> <!-- closes main left--> 







              <div id="main_center" class="content_text" style="float:left;  height:100%; width:58%; background-color: #FFFFFF; border:1px solid #c0c0c0;"> <!--opens main center--> 








                    <div id="image_box" style="float:left; background-color: #c0c0c0; height:150px; width:140px; border-color:#a0a0a0;border-style:outset;border-width:1px; margin:auto; "> 
                  

                             <?php

                             //address error handling

                             ini_set ('display_errors', 1);
                             error_reporting (E_ALL & ~E_NOTICE);

                             $query = "SELECT* FROM images WHERE member_id ='{$_SESSION['id']}' AND cartegoty 'main' ";
                             $result = mysql_query($query);
                             $result_data = mysql_fetch_array($result);


                             header("Content-type: image/jpeg") ;
                             echo $result_data['image'];


                             ?>
                    </div>

                    <a href="upload_image_page.php">click here to uplaod a picture</a>





               


                    


                    <h1>Welcome <?php echo ucfirst($_SESSION['firstname']);?></h1>
                    <a href="member_profile.php">My Profile</a> | <a href="logout.php">Logout</a>
                    <p>This is a password protected area only accessible to members. </p>
                    <a href="blog_entries.php">Add to Hahap Tok Library</a> 






               </div> <!-- closes main center--> 






              <div id="main_right" style="float:left; background-color: #FFFFFF; height:100%; width:20%; border-color:#a0a0a0;border-style:outset;border-width:1px; margin:auto; "> <!--opens the white content area--> 



                     <div id="main_right_top" style="float:left; background-color: #FFFFFF; height:33%; width:100%; border-color:#a0a0a0;border-style:outset;border-width:1px; margin:auto; "> <!--opens the white content area--> 

  


                     </div> <!-- closes main left top--> 




                     <div id="main_right_center" style="float:left; background-color: #FFFFFF; height:33%; width:100%; border-color:#a0a0a0;border-style:outset;border-width:1px; margin:auto; "> <!--opens the white content area--> 

  


                     </div> <!-- closes main left center--> 




                     <div id="main_right_bottom" style="float:left; background-color: #FFFFFF; height:34%; width:100%; border-color:#a0a0a0;border-style:outset;border-width:1px; margin:auto; "> <!--opens the white content area--> 

  


                     </div> <!-- closes main left bottom--> 



               </div> <!-- closes main right--> 








        </div> <!-- closes main--> 










  <?php require('footer.html'); ?>





 

 

Link to comment
Share on other sites

Ok some new developements, first of all I included the connect to database line in the php block containing the select query.  I also deleted the line  following line     

 

 

header("Content-type: image/jpeg") ;[code=php:0]

 

That seems to eliminate the blank problem.  The page can now be displayed, but in the image box,  the following error message is observed,

 

mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a7522929/public_html/member_index.php  on line 118

 

What's worng with this function?  And how else can I display an image without the header line?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.