Fatal error: Call to undefined function mysqli_connect()
Simply do it sudo apt install php-mysqli It works perfectly and it is version independent
Simply do it sudo apt install php-mysqli It works perfectly and it is version independent
Alright, I just found the solution. The problem turned out to be that the host shouldn’t have been localhost, but 127.0.0.1. I always thought localhost and 127.0.0.1 was the same, but it turned out to be different. So maybe as a tip for future users, always use the ip when in doubt.
The first thing to do would probably be to replace every mysql_* function call with its equivalent mysqli_*, at least if you are willing to use the procedural API — which would be the easier way, considering you already have some code based on the MySQL API, which is a procedural one. To help with … Read more
Each method of mysqli can fail. Luckily, nowadays mysqli can report every problem to you, all you need is ask. Simply add this single line to the connection code, mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); And after that every error will reveal itself. No need to test any return values ever, just write your statements right away: $stmt … Read more
Although both methods work with * queries, when bind_result() is used, the columns are usually listed explicitly in the query, so one can consult the list when assigning returned values in bind_result(), because the order of variables must strictly match the structure of the returned row. Example 1 for $query1 using bind_result() $query1 = ‘SELECT … Read more
The problem is that the package that used to connect PHP to MySQL is deprecated (php5-mysql). If you install the new package, sudo apt-get install php-mysql this will automatically update Apache and PHP 7.
I am using MariaDB and have a similar problem. From MariaDB site, it is recommended to fix it by Switch to using the mysqlnd driver in PHP (Recommended solution). Recompile PHP with the MariaDB client libraries. Use your original MySQL client library with the MariaDB. My problem was fixed by using the mysqlnd driver in … Read more
The problem lies in: $query = $this->db->conn->prepare(‘SELECT value, param FROM ws_settings WHERE name = ?’); $query->bind_param(‘s’, $setting); The prepare() method can return false and you should check for that. As for why it returns false, perhaps the table name or column names (in SELECT or WHERE clause) are not correct? Also, consider use of something … Read more
Yes you need to protect against this. Let me show you why, using Firefox’s developer console: If you don’t cleanse this data, your database will be destroyed. (This might not be a totally valid SQL statement, but I hope I’ve gotten my point across.) Just because you’ve limited what options are available in your dropdown … Read more
change localhost to 127.0.0.1 in /etc/phpmyadmin/config.inc.php $cfg[‘Servers’][$i][‘host’] = ‘127.0.0.1’; The reason for this is that pma tries to connect to the mysql.socket if you use localhost. If you use 127.0.0.1 PMA makes a TCP connection which should work.