2
I have a problem here with Mysql, is giving errors, I’ve made all kinds of changes. I’ve tried to change the Mysql function to Mysqli and only increase errors.
Code:
<?php
$sql["host"] = "localhost";
$sql["usuario"] = "root";
$sql["senha"] = "arfito";
$sql["base"] = "digify";
$conexao = mysql_connect($sql["host"],$sql["usuario"],$sql["senha"]);
$select_database = mysql_select_db($sql["base"], $conexao);
mysql_query("SET NAMES utf8");
?>
and the following error:
Fatal error: Uncaught Error: Call to Undefined Function mysql_connect() in /var/www/public_html/includes/config.php:6 Stack trace: #0 /var/www/public_html/index.php(7): include() #1 {main} thrown in /var/www/public_html/includes/config.php on line 6
When I switch from Mysql to Mysqli the following error:
Warning: mysqli_select_db() expects Parameter 1 to be mysqli, string Given in /var/www/public_html/includes/config.php on line 7
Warning: mysqli_query() expects at least 2 Parameters, 1 Given in /var/www/public_html/includes/config.php on line 8
Fatal error: Uncaught Error: Call to undefined function mysql_fetch_array() in /var/www/public_html/index.php:9 Stack trace: #0 {main} thrown in /var/www/public_html/index.php on line 9
Line #9 of Index.php code:
$web = mysql_fetch_array(mysql_query("SELECT * FROM settings ORDER BY id DESC LIMIT 1"));
mysql* does not exist since php version 7 so you really have to use mysqli. Show which code you used for the mysqli version. I remember that
mysqli_query
takes as first parameter the link– Isac
I just have this code on top, I’m not very good with mysqli. I thought it was only necessary to change mysql to mysqli.
– Abd Domingos