Deprecated: MySQL_Connect()

Deprecated: mysql_connect()

There are a few solutions to your problem.

The way with MySQLi would be like this:

<?php
$connection = mysqli_connect('localhost', 'username', 'password', 'database');

To run database queries is also simple and nearly identical with the old way:

<?php
// Old way
mysql_query('CREATE TEMPORARY TABLE `table`', $connection);
// New way
mysqli_query($connection, 'CREATE TEMPORARY TABLE `table`');

Turn off all deprecated warnings including them from mysql_*:

<?php
error_reporting(E_ALL ^ E_DEPRECATED);

The Exact file and line location which needs to be replaced is "/System/Startup.php > line: 2 " error_reporting(E_All); replace with error_reporting(E_ALL ^ E_DEPRECATED);

How to hide Deprecated: mysql_connect() warning?

For your own safety: Just don't use mysql_connect!

Switch to mysqli or pdo.


Anyway to hide/suppress deprecated warnings you may do:

error_reporting(E_ALL ^ E_DEPRECATED);

or to suppress all errors/warnings:

error_reporting(0);

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead

  <?php
$con = mysqli_connect("localhost","root","","register");

// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>

// try this..



Related Topics



Leave a reply



Submit