-2

Can anybody help me to fix this error? I try with some solutions here but it appear another error in the index.php page. I asked the hosting company to downgrade the version but they don't accept.

Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home2/mohamed/public_html/portal/includes/DBclass.php on line 7

class mysqlQueryClass {
    var $result,$resultNoRows;

    function dbConnect(){
        $dbConnect=mysql_pconnect(_DATA_BASE_HOST_, _DATA_BASE_USER_, _DATA_BASE_BASSWORD_)
        or die(mysql_error());
        mysql_select_db(_DATA_BASE_NAME_)
        or die(mysql_error());
        return $dbConnect;

Thanks in advance

Shadow
  • 33,525
  • 10
  • 51
  • 64
Mohamed
  • 1
  • 4
  • If you don't want use mysqli or PDO, why don't you ignore the deprecate message? – Federkun May 06 '17 at 14:37
  • 1
    Don't use `mysql_*` functions. Look into `mysqli` or `PDO` instead. Downgrade PHP to an old unsupported version is a bad idea. – M. Eriksson May 06 '17 at 14:37
  • This is not an error message, this is just a notice. – Shadow May 06 '17 at 14:38
  • _"I try with some solutions here but it appear another error in the index.php page."_ What was the solution you tried and what was the other error message? – M. Eriksson May 06 '17 at 14:41
  • replaced all mysql to mysqli only replace in the same file DBclass.php – Mohamed May 06 '17 at 14:43
  • *"replaced all mysql to mysqli only replace in the same file DBclass.php"* - if you're still including `mysql_` mixed in with `mysqli_` somewhere, those different mysql api's do not intermix. If you are using `mysqli_` somewhere, make sure the syntax is correct and are passing db connection to functions that require it. – Funk Forty Niner May 06 '17 at 14:44
  • i replaced in DBclass.php all mysql to mysqli all now but appear now this error ( Fatal error: Class 'mysqlQueryClass' not found in /home2/mohamed/public_html/portal/index.php on line 11 ) i must change all mysql to mysqli in index.php also ?? – Mohamed May 06 '17 at 14:58
  • 1
    Did you change the name of that class? You need to do a proper refactoring of your code, not just replace `mysql` to `mysqli`. – M. Eriksson May 06 '17 at 15:01
  • yes only replaced not change anything else i dont know how to change the class – Mohamed May 06 '17 at 15:03

1 Answers1

0

Upgrade to mysqli or suppress E_DEPRECATED messages:

error_reporting(E_ALL ^ E_DEPRECATED);
Halcyon
  • 57,230
  • 10
  • 89
  • 128