proctk Posted July 21, 2007 Share Posted July 21, 2007 I'm trying to figure out away to toggle a persons user Id. On a page there is a link that when clicked that persons profile comes up. which sets the value $_get[id]. When this is done for some reason the session values are set the clicked persons values.. The session values need to stay to equal the logged in persons user Id. hope this makes sense, any ideas how to fix this if(isset($_GET['id'])){ $user_id = $_GET['id']; } if(!isset($_GET['id'])){ $user_id = $_SESSION['user_id']; } Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted July 21, 2007 Share Posted July 21, 2007 Just access the variables directly or name them differently... Quote Link to comment Share on other sites More sharing options...
proctk Posted July 21, 2007 Author Share Posted July 21, 2007 not sure I understand the variable is used on a query. When I click on the link the reloading of the page messes up the session variables $query_get_details = ("SELECT * FROM users WHERE user_id = $user_id"); $get_details = mysql_query($query_get_details)or die("SQL Error: $query_get_family<br>" . mysql_error()); $details = mysql_fetch_assoc($get_details); the complete code for the page thank you //Get Spouse information $spousefirstname = $details['spousefirstname']; $spouselastname = $details['spouselastname']; $spousedob = $details['spousedob']; ?> <!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');?> <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'); //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()); $spouseS=mysql_fetch_assoc($spouseResult); $spouse_id = $spouseS['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> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.