Jump to content

can not use object as type mysqli_result as array???


darkfreaks

Recommended Posts

Fatal error: Cannot use object of type mysqli_result as array in /home/kabooc/public_html/user_profile.php on line 43

 

so how do i fix this ???

<?php
$rank_check = 1;
$page_title = "User Profile";
include "header.inc.php";

$db_server   = "localhost";
$db_username = "kabooc_Bryce";
$db_password = "doom";
$db_name     = "kabooc_pets";
$con=mysqli_connect($db_server,$db_username,$db_password);
mysqli_select_db($con,$db_name);


$members = fetch("SELECT * FROM members2 WHERE username = '$user' AND game = '$game'");
$members_profiles = fetch("SELECT * FROM members_profiles2 WHERE username = '$user' AND game = '$game'");
$profile_id = fetch("SELECT id FROM `members2` WHERE username = '$members[username]'");


$online = fetch("SELECT last_visit FROM online WHERE userid = '$members[id]' ORDER BY last_visit DESC LIMIT 1");

if ($rank >= "5")
{
$iplog = fetch("SELECT ip_addr FROM ip_log WHERE userid = '$members[id]' ORDER BY id DESC LIMIT 1");
$membersIP = " ($iplog[ip_addr])";
}
if (!$members[id])
{
die("$openHTML<p align=center class=error>That is not a real user</p>$closeHTML");
}


if ($members[rank] <= 1)
{
die("$openHTML<p align=center class=error>This user has been suspended.</p>$closeHTML");
}

$gender = $members_profiles[gender];
$genderArray = array("<img src=images/icons/undecided.gif>", "<img src=images/icons/female.gif>", "<img src=images/icons/male.gif>");
$gender = $genderArray[$gender];

$mailSettings = $members_profiles[mail_settings];
$mailSettingsArray = array( //error line
"<a href=mail_send.php?game=$game&send_to=$usersOn[username]><img src=images/icons/mail.gif></a>",
"<a href=mail_send.php?game=$game&send_to=$usersOn[username]><img src=images/icons/mail.gif></a>",
"");?>

Link to comment
Share on other sites

Function Fetch:

<?php


function fetch($query) {
$db_server   = "";
$db_username = "";
$db_password = "";
$db_name     = "";
$con=mysqli_connect($db_server,$db_username,$db_password);
mysqli_select_db($con,$db_name);
  if ($result = mysqli_query($con,$query)) {
    if (mysqli_num_rows($result) == 1) {
      return mysqli_fetch_assoc($result);
    } else if (mysqli_num_rows($result) > 1) {
      while ($row = mysqli_fetch_assoc($result)) {
        $return[] = $row;
      }
      return $return;
    }
    return false;
  }
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.

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