0

hi every one,
i need your help in my php code.Currently i m developing one social site.
i had develop php code code for getting recent update from friends.
my error is for not printing recent update from friends.
i had tried my best but it's not working.
i m attaching code with this article.
please help me.

<?php //code for get values from session
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 //code for get value of usercode from database
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'];
		
	}
}
?>
<?php //code to fetch friends name from isfriend table and store them in array.
error_reporting(0);
$cout = 0;
$aros;
mysql_connect("localhost", "root", "") or die(mysql_error()); 
mysql_select_db("dummy1") or die(mysql_error());
$check = mysql_query("SELECT * FROM isfriend WHERE rececode = '$mycode'")or die(mysql_error()); 
while($info = mysql_fetch_array($check))
{
	if ($info['actives'] == 1 and $info['friends'] == 1)
	{
		
		$aros[$cout] = $info['usercode'];
		$cout = 1 + $cout;
	}
}
sort($aros);
?>
<?php //using inter join code will print username from member table and directory name from imgallry table 
error_reporting(0);
$cout = 0;
$aros;
mysql_connect("localhost", "root", "") or die(mysql_error()); 
mysql_select_db("dummy1") or die(mysql_error());
$ibo = "SELECT imgallry.dirname FROM imgallry INNER JOIN members ON imgallry.usercode = members.usercode ORDER BY imgallry.date DESC";
$check = mysql_query($ibo)or die(mysql_error()); 
while($info = mysql_fetch_array($check))
{
	if ($info['members.usercode'] == $aros[$cout])
	{
		echo $info['members.username'];
		$cout = 1 + $cout;
	}
}

?>
1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by ujjval dave
0

well i had solved this problem
here is code

<?php
error_reporting(0);
$cout = 0;
mysql_connect("localhost", "root", "") or die(mysql_error()); 
mysql_select_db("dummy1") or die(mysql_error());
$query = "SELECT imgallry.dirname, members.usercode ". "FROM imgallry, members "."WHERE imgallry.usercode = members.usercode ORDER BY imgallry.date DESC";
//$ibo = "SELECT imgallry.dirname, imgallry.usercode FROM imgallry INNER JOIN members ON imgallry.usercode = members.usercode ORDER BY imgallry.date DESC";
$check = mysql_query($query)or die(mysql_error()); 
while($info = mysql_fetch_array($check))
{
	/*if ($info['members.usercode'] == $aros[$cout])
	{
		echo $info['members.username'];
		$cout = 1 + $cout;
	}*/
	
	echo $info['usercode']. " - ". $info['dirname'];
	echo "<br />";
}

?>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.