Lostnode Posted September 3, 2014 Share Posted September 3, 2014 Hello all. I am using a premade login script which has some very powerful function built in, the one I am looking at using is as follows: /** * query - Performs the given query on the database and * returns the result, which may be false, true or a * resource identifier. */ function query($query){ return mysqli_query( $this->connection, $query); } The issue is, displaying the results. I call is via the following code: $database->query('SELECT LastName, Firstname FROM Patrons WHERE LastName = "Delude"'); But I have no idea how to display it. I have attempted to echo it out, but I get the following error in the logs: PHP Catchable fatal error: Object of class mysqli_result could not be converted to string Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted September 3, 2014 Share Posted September 3, 2014 The function returns a result object. More information can be found here: http://php.net/manual/en/mysqli.query.php Does the login script have another function for looping through query results? If not, you could create a loop like you would do for any other query. A loop could be created using mysqli_fetch_assoc(), for example: http://php.net/manual/en/mysqli-result.fetch-assoc.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.