Dark Sterix Dark Sterix - 2 years ago 62
SQL Question

My whole script is not working because of a deprecated mysql

This is the line that is causing problems.

mysql_connect($dbhost ,$dbuser, $dbpass); mysql_select_db($dbname);

mysql_query("SET NAMES 'utf8'");

I just got the code from codecanyon and I don't understand how to fix it. It says that it's deprecated

Answer Source

Please try with example

$servername = "localhost";
$username = "username";
$password = "password";

// Create connection
$conn = new mysqli($servername, $username, $password);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
echo "Connected successfully";

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download