I (hope) this is a very straightforward question about what is being missed for PHP/MySQL. First, the computers are Windows 7 machines and are running XAMPP (Apache, PHP, MySQL, etc.) - nothing Windows/IIS, etc.
The machines are quick, with PHP & MySQL running super-fast. However, there is one machine where the way it works with PHP & MySQL is some kind of delay - specifically, it is essentially 3 seconds. In fact, if you remove EVERYTHING the code is doing so that it is doing NOTHING more than setting up its connection like this:
$db = new mysqli($hostname, $username, $password, $database);
...and there is no query or anything - just this PHP line that sets up the object, it takes exactly 3 seconds.
You comment out this line, by contrast, and the page is instant.
Anyway idea why this is happening? It doesn't look like anything is wrong, exactly, just somehow set up on this 3 seconds that we'd like to get rid of. Thanks!
The installation process with MySQLi not only easy, but is automatic when the PHP5 MySQL package is installed in Windows or Linux. MySQLi performs (slightly) faster than its competition. With non-prepared statements, the system performs ~2.5% faster, and ~6.5% faster with prepared ones.
The oldest one uses the MySQL extension, which was deprecated as of PHP 5.5 and fully removed in PHP 7. The mysql() function no longer works in PHP 7. It has been replaced with mysqli().
PHP mysqli_num_rows function The mysqli_num_rows function is used to get the number of rows returned from a select query. It has the following syntax.
The connect() / mysqli_connect() function opens a new connection to the MySQL server.
If this is hosted locally and you are using localhost this will be your problem, try using
$db = new mysqli('127.0.0.1', $username, $password, $database);
This is because of how MYSQLI
handles localhost and IPV6
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With