Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7706393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:06:54+00:00 2026-06-01T00:06:54+00:00

The following method does its job but keeps printing a warning also, im pretty

  • 0

The following method does its job but keeps printing a warning also, im pretty new to OOP so i would like to know why exactly.

I have done some Googling and it seems likes its me mixing procedural with OOP which is giving the warning, well from the replies i have read elsewhere at least.

The code:

function __construct(){
    global $connection;

    $mysqli_result=$connection->query("select module from modules");
    while($row=$mysqli_result->fetch_row()){
        $this->whitelist[]=$row[0];
    }
    mysqli_free_result($row);
    return;
}

The warning:

mysqli_free_result() expects parameter 1 to be mysqli_result, null given in.....

I would appreciate someone shedding some light on this if possible.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T00:06:55+00:00Added an answer on June 1, 2026 at 12:06 am

    You are using MySQLi in an object oriented fashion, and you cannot use the procedural functions with it incorrect, see edit. You would do:

    $mysqli_result->free()
    

    …instead.

    Even if you were using the procedural approach, what you have done is incorrect because fetch_row() returns an array, and mysqli_free_result() would expect the result resource – you would need to do:

    mysqli_free_result($mysqli_result);
    

    …but for your code, the first example is what you want.

    EDIT

    Actually, after testing, you can in fact use the second option as well. But still, the first option is the best fit for your code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following method does not work because the inner block declares a variable of
The following method does not compile. Visual Studio warns An out parameter may not
The following method does not apply the wpf changes (background = red) until the
Why does the following method hang? public void pipe(Reader in, Writer out) { CharBuffer
does anyone know if the following java Method in the java.util.concurrent Package ScheduledExecutorService.html#scheduleAtFixedRate() absolutely
In Python compiled regex patterns have a findall method that does the following: Return
The following method, when called with something like String val = getCell(SELECT col FROM
Say we have the following method: private MyObject foo = new MyObject(); // and
I added the following lines to Application_Start method in global.asax: var provider = new
I have a UIPopoverController in a view, and the following method to update its

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.