Jump to content

Can't use function return value in write context


zero_ZX
 Share

Recommended Posts

Hi,

I have some strange issues with my code:

 

<?PHP
session_start(); 
$loginid = $_SESSION["valid_id"];
// First check if we are guest or user.
if (!$_SESSION["valid_email"])
{
$visitor = "yes";
}
else
{
$visitor = "no";
$email = $_SESSION['valid_email'];
$userid = $_SESSION['valid_id'];
}
//Load Header (blue menu)
require("./inc/header.php");
//Load Sub-acc (silver account menu)
require("./inc/sub-group.php");
//Load nav-group (Tabs)
require("./inc/nav-group.php");
//Load Config file
require("./inc/config.php");
//Set & get profile ID
$getid = $_GET["id"];
//check ID
$result = mysql_query("SELECT * FROM profiles WHERE id=('$getid')  LIMIT 1");
$row = mysql_fetch_array($result);

IF (mysql_num_rows($result) != 1)
{
exit("Invalid ID");
}

//If we are guest, do we allow anon access to the profile
IF ($row["privacy"] <= 10 && $visitor = "yes")
{
exit("You may not view this profile as a visitor, due to the users privacy settings");
}
//Let's check if we are friends
ELSEIF ($visitor = "no")
{
$result2 = mysql_query("SELECT * FROM profiles_friends WHERE user=('$getid') AND target=('$loginid')  LIMIT 1");
$row2 = mysql_fetch_array($result2);
$friends = $row2["status"];
if (mysql_num_rows($result2) = 0)
{
	$friends = "no";
}
}

//If we are friend, do we allow access to the profile
IF ($row["privacy"] >= 9 && $friends != 1)
{
exit("You may not view this profile because of the privacy settings.");
}

$row = mysql_fetch_array($result);
$memgroup = $row["group"];
IF ($row["activated"] != 1)
{
exit("This account is suspended and cannot be viewed.");
}


//Check what group member is in.
$result2 = mysql_query("SELECT * FROM profiles_groups WHERE id=('$memgroup')  LIMIT 1");
$row2 = mysql_fetch_array($result);

?>

 

Alright, so the error: Fatal error: Can't use function return value in write context in C:\xampp\htdocs\prog\profile.php on line 45

42.	$result2 = mysql_query("SELECT * FROM profiles_friends WHERE user=('$getid') AND target=('$loginid')  LIMIT 1");
43.	$row2 = mysql_fetch_array($result2);
44.	$friends = $row2["status"];
45.	if (mysql_num_rows($result2) = 0)

Alright, this is one thing that bothers me, the other is:

//check ID
$result = mysql_query("SELECT * FROM profiles WHERE id=('$getid')  LIMIT 1");
$row = mysql_fetch_array($result);

IF (mysql_num_rows($result) != 1)
{
exit("Invalid ID");

I tried to put an invalid ID, and already here the script should have died/exited before executing the parts of the code that doesn't work.

I tested my code on another page and it works flawlessly, perhaps this error is just generated before it actually exists i dunno..

 

Any way, any help is much appreciated :)

}

Link to comment
Share on other sites

This thread is more than a year old.

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.

 Share

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