Error php version update Deprecated The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in

PHP 0 Comments

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in. Notice: Undefined variable, Undefined index, and Undefined offset using PHP

Error php version update Deprecated The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in

 

@mysql_connect(DB_HOST,DB_USER,DB_PASSWORD)

 

<?php 
define('DB_HOST', 'localhost');
define('DB_NAME', 'databsename');
define('DB_USER','databaseuser');
define('DB_PASSWORD','password');
$con=@mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die("Failed to connect to MySQL: " . mysql_error());
$db=mysql_select_db(DB_NAME,$con) or die("Failed to connect to MySQL: " . mysql_error());
?>

 

 

<?php
$connect = @mysql_connect('localhost','root','');
mysql_select_db('dbname');
?>

2nd type

 

ini_set('display_errors', 0);
ini_set('log_errors', 1);

 

Write this code top side

 

<?php 
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(E_ALL);
?>
<html>
</html

 

 

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
# Turn off all error reporting
error_reporting(0);
$connect_myconn = "Database Connection";
$hostname_myconn = "localhost";
$database_myconn = "db name";
$username_myconn = "user name";
$password_myconn = "pass";
$myconn = mysql_connect($hostname_myconn, $username_myconn, $password_myconn) or die("<h1 style=margin:0;>A MySQL error has occurred.</h1><p><b>Your Query:</b> " . $connect_myconn . "<br /> <b>Error Number:</b> (" . mysql_errno() . ")</p>" . mysql_error());
mysql_select_db($database_myconn, $myconn);
?>

 

Index error show

@$type=$_REQUEST['check'];

@$error="";

 

Notice: Undefined variable, Undefined index, and Undefined offset using PHP

 

used empty condition in case

$var = @($_GET["optional_param"]);

$user_name = '';
if (!empty($_SESSION['user_name'])) {
     $user_name = $_SESSION['user_name'];
}

var_dump($_GET);
var_dump($_POST);
//print_r($_REQUEST);


if( !empty($user){

}

if (!isset($_POST['value'])) {
    $value = null;
}


$a=10;
if($a==5) { 
echo 'hello';
}