Obsolete mysql_pconnect problem

mysql_pconnect(): Access denied for user 'root'@'localhost' (using password: YES) in **D:\XAMP\htdocs\Connections\DO.php** on line **9**

Im getting this error How to solve this

My sql

$DO = mysql_pconnect($hostname_DO, $username_DO, $password_DO) or trigger_error(mysql_error(),E_USER_ERROR);

Full:

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_DO = "127.0.0.1";
$database_DO = "do_es";
$username_DO = "root";
$password_DO = "lel";
$DO = mysql_pconnect($hostname_DO, $username_DO, $password_DO) or trigger_error(mysql_error(),E_USER_ERROR);

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
?>

Your mysql root password is not ‘lel’. Figure out what it actually is.

Better yet, don’t use root for actual transactions.

You have a bigger problem in the fact that all the mysql_* functions were REMOVED from PHP 7.0 and as of PHP 7.0 the two options are the mysqli_* extension or PDO

4 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.