I'm trying to move my site to a server with php7 with mysqli:
I have a conexion.php file that I modified and now looks like this:
<?php
$hostname_conexion = "localhost";
$database_conexion = "opentach";
$username_conexion = "root";
$password_conexion = "";
# $conexion = mysql_connect($hostname_conexion, $username_conexion, $password_conexion) or trigger_error(mysql_error(),E_USER_ERROR);
$conexion = new mysqli('localhost', 'root', '', 'opentach');
?>
I have only commented the mysql_connect line and I have incorporated the mysqli line
When loading it gives me the following error, which means?:
Warning: mysqli_select_db () expects parameter 1 to be mysqli, string given in /var/www/html/opentach/index.php on line 84
Warning: mysqli_query () expects parameter 1 to be mysqli, string given in /var/www/html/opentach/index.php on line 86
Warning: mysqli_error () expects exactly 1 parameter, 0 given in /var/www/html/opentach/index.php on line 86
the lines of the index they refer to are:
mysqli_select_db($database_conexion, $conexion);
$query_datos_meta = "SELECT * FROM configuracion WHERE idioma = '".$_SESSION['idioma']."'";
$datos_meta = mysqli_query($query_datos_meta, $conexion) or die(mysqli_error());
$row_datos_meta = mysqli_fetch_assoc($datos_meta);
$totalRows_datos_meta = mysqli_num_rows($datos_meta);
It's modified, the only thing I've done is change mysql
by mysqli
.