hi every one,
i need your help in php code.
my error is for profile page.
after implementing lots of php code in this page,my page became auto refresh in every 2secound.
i don't know what happend to it.
i m attaching my code pls elp me.

<?php //get code from session value
session_start();

if(isset($_SESSION['I'])){
//this code will get email id from session
$myeid = $_SESSION['I'];}
else{
header("Location: loginimgs.php");}

if(isset($_SESSION['NEED'])){
//this code will get password from session
$mypass = $_SESSION['NEED'];}
else{
header("Location: loginimgs.php");}

?>
<?php //get code for my code
error_reporting(0);
$myuname = "";
mysql_connect("localhost", "root", "") or die(mysql_error()); 
mysql_select_db("dummy1") or die(mysql_error());
$check = mysql_query("SELECT * FROM members WHERE email = '$myeid'")or die(mysql_error()); 
while($info = mysql_fetch_array($check))
{
	if ($myeid == $info['email'])
	{
		$myuname = $info['username'];
		$mycode = $info['usercode'];
		$_SESSION['USER'] = $myuname;
		
	}
}
?>
<?php //code for recent view insert
error_reporting(0);
$date = date("Y-m-d H:i:s");
if (isset($_GET['uid']))
{
	$serfcode = $_GET['uid'];
}
else
{
	echo '<META HTTP-EQUIV="Refresh" Content="2; URL=Profile.php">';
}

if (isset($_GET['uid']))
{
	if($_GET['uid'] != md5($mycode))
	{
		mysql_connect("localhost", "root", "") or die(mysql_error()); 
		mysql_select_db("dummy1") or die(mysql_error());
		$st = "INSERT INTO recentview (usercode, reccode, date) VALUES ('".$mycode."', '".$serfcode."', '".$date."')";
		$add_member = mysql_query($insert) or die(mysql_error());
	}
}
?>
<?php // check for user is friend or not
error_reporting(0);
if(isset($_GET['uid']))
{
	$uid = $_GET['uid'];
	mysql_connect("localhost", "root", "") or die(mysql_error()); 
mysql_select_db("dummy1") or die(mysql_error());
$ssq = mysql_query("SELECT * FROM isfriend WHERE usercode = '$mycode'") or die(mysql_error());
while($info = mysql_fetch_array($ssq))
{
	if($info['rececode'] == $uid)
	{
	
	}
	else
	{
		echo '<META HTTP-EQUIV="Refresh" Content="2; URL=search.php">';
		die($uid . "  is Not Your Friend.");
		
		
	}
}
}

?>



<!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=utf-8" />
<title>Welcome Back <?php echo $myuname; ?></title>

</head>

<body>
<a href="logout.php">Logout</a>
<a href="accountSetting.php">Account Setting</a>

<?php  //code for friend request
error_reporting(0);
mysql_connect("localhost", "root", "") or die(mysql_error()); 
mysql_select_db("dummy1") or die(mysql_error());

$ssq = mysql_query("SELECT rececode FROM isfriend WHERE rececode = '$mycode' AND actives = '1' AND checked = '0'") or die(mysql_error());
$row = mysql_num_rows($ssq);
$sedn = "";

if ($row > 0) 
{ // there are new requests
	
	
	echo "<a href='friendrequest.php'>".$row."Friend Request</a>";	
   //echo '<a href="friendrequest.php?rec=' . $mycode . '&token=' . $ycode . '">' .$row. 'Friend Request</a>';
} else {
 //echo '<a href="friendrequest.php">Friend Request</a>';
 
}


?>

<a href="Profile.php">Profile</a>
<a href="ctralbum.php">Photos</a>
<div align="right" id="search">
<form name="search" action="search.php" method="post">
Search Your Friends
<input type="text" name="search" id="search" size="20" />
<input type="submit" name="submit" value="Search" />
</form>
</div>
<div align="left">
<?php // code for display approved friends
error_reporting(0);
mysql_connect("localhost", "root", "") or die(mysql_error()); 
mysql_select_db("dummy1") or die(mysql_error());
$ssq = mysql_query("SELECT * FROM isfriend WHERE rececode = '$mycode'") or die(mysql_error());
while($info = mysql_fetch_array($ssq))
{
	if($info['usercode'] == $mycode)
	{
	
	}
	else
	{
	
		echo $info['usercode'] . "<br>";
	}
}
?>
<br />
<p><a href="manage.php">Magnage Your Friends</a></p>
</div>
<div align="left">
<p>Recent Views:</p>
<?php
error_reporting(0);
mysql_connect("localhost", "root", "") or die(mysql_error()); 
mysql_select_db("dummy1") or die(mysql_error()); 
$myf = "SELECT * FROM recentview ORDER BY date desc";
while($infod = mysql_fetch_array($myf))
{
		if($infod['reccode'] == $mycode)
		{
			echo $infod['usercode'] . " , ";
		}
}
?>
</div>
</body>
</html>

Surly using this: <META HTTP-EQUIV="Refresh" Content="2; URL=Profile.php"> wont help.

If the $_GET is not set, then the page will keep reloading. This is slightly pointless as $_GET wont suddenly become available. You should display an error message or something. This may also be your problem.

commented: solving my error +1

thanks Kieran Y5
i got my error.
thank you again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.