cs.punk Posted September 4, 2009 Share Posted September 4, 2009 Taken from the php manual of mysqli_fetch_assoc <?php $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $query = "SELECT Name, CountryCode FROM City ORDER by ID DESC LIMIT 50,5"; if ($result = $mysqli->query($query)) { /* fetch associative array */ while ($row = $result->fetch_assoc()) { printf ("%s (%s)\n", $row["Name"], $row["CountryCode"]); } /* free result set */ $result->close(); } /* close connection */ $mysqli->close(); ?> There is no class defined of 'mysqli'? Is this a built in one? And I noticed if ($result = $mysqli->query($query)) { // And later on /* free result set */ $result->close(); Where was $result made an instance of a class? Link to comment https://forums.phpfreaks.com/topic/173140-are-the-php-classes-built-in/ Share on other sites More sharing options...
rhodesa Posted September 4, 2009 Share Posted September 4, 2009 mysqli classes are available if the module is enabled: http://us.php.net/manual/en/mysqli.installation.php The method query() in the mysqli object just returns an object. The code inside query() creates a MySQLi Result Instance and then just returns it Link to comment https://forums.phpfreaks.com/topic/173140-are-the-php-classes-built-in/#findComment-912563 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.