1
I’m with this mistake when I try to host my site, I’m using shaman
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\Nova pasta\htdocs\dashboard\bd.php:21 Stack trace: #0 C:\Nova pasta\htdocs\dashboard\home.php(3): include() #1 C:\Nova pasta\htdocs\dashboard\index.php(15): include_once('C:\\Nova pasta\\h...') #2 {main} thrown in C:\Nova pasta\htdocs\dashboard\bd.php on line 21```
Meu codigo
```<?php
$hostname = 'localhost';
$user = 'root';
$pass = '';
$dbase = 'clientea_lojateste';
$db = mysql_connect($hostname,$user,$pass);
mysql_select_db($dbase);
?>
<?php
function runSQL($rsql) {
$hostname = 'localhost';
$username = 'root';
$password = '';
$dbname = 'clientea_lojateste';
$connect = mysql_connect($hostname,$username,$password) or die ("Error: could not connect to database");
$db = mysql_select_db($dbname);
$result = mysql_query($rsql) or die ('test');
return $result;
mysql_close($connect);
}
?>
<?php
$cadastr=mysql_query("SELECT * FROM admin");
$cadastro=mysql_fetch_assoc($cadastr);
$data_inicial = date('d/m/Y');
$data_final = $cadastro['data_expira'];
function geraTimestamp($data) {
$partes = explode('/', $data);
return mktime(0, 0, 0, $partes[1], $partes[0], $partes[2]);
}
$time_inicial = geraTimestamp($data_inicial);
$time_final = geraTimestamp($data_final);
$diferenca = $time_final - $time_inicial;
$dias = (int)floor( $diferenca / (60 * 60 * 24));
?>
The same commenting that I gave in the other question. Use Mysqli the extension you are using Mysql has been removed from PHP due to security breaches.
– Augusto Vasques
This answers your question? I’m trying to host my site using shaman and it’s giving the following error
– Augusto Vasques
This question would fit more in Serverfault, but unfortunately not this to Portuguese :(
– epx
The mysql_connect() function no longer exists. Use mysqli_connect().
– Dasx