1

I've got some older software that was written a few years ago but is now unsupported so I can't simply upgrade to resolve this issue.

Meaning; that I cannot go to the vendor and get a software update to resolve it.

I'm getting an error on all my pages because of this 1 line of code. I know what needs to happen to it but because I don't do much SQL programming I'm unsure how to implement it.

The code:

$dblink = mysql_connect(SB_HOST_NAME,SB_DB_USER_NAME,SB_DB_PASSWORD) OR DIE("Unable to connect to database");

The error:

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/kribs/public_html/stconfig.php on line 117

Warning: Cannot modify header information - headers already sent by (output started at /home/kribs/public_html/stconfig.php:117) in /home/kribs/public_html/key/openinfo.php on line 248

I've come across the article saying it needs to use the newer format but not sure how it applies to this situation.

Any help is much appreciated, I will continue reading to see if I can resolve it in the mean time.

Community
  • 1
  • 1
Amazon3d
  • 13
  • 4
  • *"so I can't simply upgrade to resolve this issue."* - what do you mean by this? Can you not use the `mysqli_` or PDO apis? – Funk Forty Niner Jan 16 '17 at 14:10
  • I mean that I cannot go to the vendor and get a software update to resolve it. I tried to add the mysqli_ method but having trouble adapting it to work in the way it was used on this config file. – Amazon3d Jan 16 '17 at 14:18

2 Answers2

0

The original MySQL extension is now deprecated, and will generate E_DEPRECATED errors when connecting to a database. Instead, use the MySQLi or PDO_MySQL extensions. http://php.net/manual/en/migration55.deprecated.php

Michael
  • 405
  • 4
  • 10
  • Did you not read this part? *"I've got some older software that was written a few years ago but is now unsupported so **I can't** simply upgrade to resolve this issue."* – Funk Forty Niner Jan 16 '17 at 14:07
  • By upgrade I mean I can't go to the vendor and get a new version. I have direct access to the code however so I can upgrade it by hand. Perhaps I was not clear enough. – Amazon3d Jan 16 '17 at 14:44
0

You can turn off those warnings with error_reporting

Here You go:

// Report all errors except E_DEPRECATED
error_reporting(E_ALL & ~E_DEPRECATED);
malutki5200
  • 1,092
  • 7
  • 15