Jump to content

page loading problem


proctk

Recommended Posts

Hi the below code is kinda working but its only loading part of the page, when I do a page refresh the rest of the page loads.  the part of the page that is not loading correctly is the bottom 1/2 which displays images.  any help is excellent

 

<?php
/* Check User Script */
session_start();  // Start Session
include ("Connections/db.php");
//check if user is already logged in
if (!isset($_SESSION['user_id'])){

$msg = 'You tryed to access a members only page. Login or become a registered member to access that page!';

header("Location: index.php?msg=".$msg); 
}

if(isset($_GET['id'])){
$id = $_GET['id'];
}else{
$id = $_SESSION['user_id'];

}

?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>

<link href="design/main.css" rel="stylesheet" type="text/css" />

</head>

<body>
<div id="outer">
<? include ('design/banner1.php');

$query_get_details = ("SELECT * FROM users WHERE user_id = '$id'");
$get_details = mysql_query($query_get_details)or die("SQL Error: $query_get_family<br>" . mysql_error());
$details = mysql_fetch_assoc($get_details);
?>

	  <div id="twoColumnRight">
	  <div class="profilePage">
	  <div class="subHeader">
	  <h3 style="margin-left:250px; color:#848484; padding-top:10px;"><?php echo $details['first_name'].' '. $details['last_name']; ?></h3>
	  </div>
	  
	  
	  <?php
$member_details = 'member'.'-'.$details['first_name'].','.$details['last_name'].'-'.$details['user_id'];
  
$result = mysql_query("SELECT * FROM image_files WHERE user_id = '$user_id' AND details = '$member_details'") or die("Can't Perform Query");

$row=mysql_fetch_array($result);

$count=mysql_num_rows($result);

if($count >0){

    	$image = "user_images/".$row['image_name'];
	$tempimg = getImageSize($image);
	$size = $tempimg[3];
	$size = explode("\"",$size);
	$width = $size[1];
	$height = $size[3];

	$newwidth=200;
	$newheight=($height/$width)*200;
  
  ?>
  
  <div class="profilePhoto"><img src="user_images/<?php echo $row['image_name'];?>" width="<?php echo $newwidth; ?>" height="<?php echo $newheight; ?>" alt="<?php echo $row['image_name'];?>" />

</div>
<?php } ?>
<?php if($count == 0){?>
  <div class="profilePhoto"><img src="user_images/blankAlbum.jpg" width="125" height="100" alt="blankAlbum.jpg" />
  </div>
  <?php }?>
  
  <?php if(!empty ($newheight)){
$profileHeight = $newheight - 25;

  }else{
  $profileHeight = 75;
  } 
  
   ?>
  <div class="profileInfo" style="margin-top:-<?php echo $profileHeight; ?>px;">
  <p><strong style="color:#848484;">Last Login:</strong><span style="color:#5e49d9; margin-bottom:3px;"> <?php echo $details['last_login']; ?></span></p>
  <p><strong style="color:#848484;">Email:</strong><span style="color:#5e49d9; margin-bottom:3px;"> <?php echo $details['email_address']; ?></span></p>
<p> <strong style="color:#848484;">Address:</strong><span style="color:#5e49d9;margin-bottom:3px;"> <?php echo $details['street_address'].' '. $details['post_office_box'].'<br>'.$details['city'].' '.$details['province'].' '.$details['postal_code']; ?></span></p>

<?php if($_SESSION['user_id'] = $details['user_id']){ ?>
  <a style="color:#848484; font-weight:bold;" href="UpdateMyInformation.php">Edit</a>
  <?php }?>
  <h5 class="tiltle5">Spouse</h5>
    <?php 
   
   $query_get_family = ("SELECT * FROM image_files WHERE user_id = '$user_id' AND album = 'spouse' ORDER BY image_size");
   
   $get_family = mysql_query($query_get_family)or die("SQL Error: $query_get_family<br>" . mysql_error());	 
   while($member=mysql_fetch_assoc($get_family)){
   
   	?>
   <?php
  
if($count >0){

    	$image = "user_images/".$member['image_name'];
	$tempimg = getImageSize($image);
	$size = $tempimg[3];
	$size = explode("\"",$size);
	$width = $size[1];
	$height = $size[3];

	$newwidth=50;
	$newheight=($height/$width)*50;

	$get_id = explode("-",$member['image_name']);
	$id = $get_id[2];

$currentDate = date('Y-m-d');

//Get Spouse information
$spousefirstname = $details['spousefirstname'];
$spouselastname = $details['spouselastname'];
$spousedob = $details['spousedob'];

//Check If spouse is a registered user, if so offer link to view thier family profile if not display spouses name only
$spouse_check = "SELECT * FROM users WHERE first_name ='$spousefirstname' AND last_name='$spouselastname' AND DOB ='$spousedob'";

$spouseResult=mysql_query($spouse_check)or die("Spouse Query Error: ".mysql_error()); 

  $spouse=mysql_fetch_assoc($spouseResult);
   
  $spouse_id = $spouse['user_id'];
   

//end spouse data checkS

  ?>
  <div class="thumb" style="padding:2px;"><a href="profile.php?id=<?php echo $spouse_id; ?>"><img src="user_images/<?php echo $member['image_name'];?>" width="<?php echo $newwidth; ?>" height="<?php echo $newheight; ?>" alt="<?php echo $member['image_name'];?>" /></a> </div>

<?php } 
  }?>
   </div>
   <div class="profileInfo" style=" margin-top:110px;">
   
  <h5 class="tiltle5">Family Profile</h5>
  
   </div>
  </div>
    
</div> 

  	 	</div>
	  
</div>
	<div id="twoColumnLeft">


	</div>

        
	<div id="footer">
	<?php include('design/footer.php'); ?>
	</div>
</div>

</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/61125-page-loading-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.