3

I am trying to use MDB2.php. I have downloaded XAMPP with the PHP 5.4 version. I understand that, in order to use MDB2, I need to include it in my PHP file. This is how I am doing it:

My createTable.php file its in C:\Users\Lexy Feito\Desktop\xampp\htdocs\php\COPassig3.

So I use the code:

require "../../../php/pear/MDB2.php";

to include the MDB2.php file located in C:\Users\Lexy Feito\Desktop\xampp\php\pear however this is returning the following errors:

Deprecated: Assigning the return value of new by reference is deprecated in C:\Users\Lexy Feito\Desktop\xampp\php\pear\MDB2.php on line 390

Deprecated: Assigning the return value of new by reference is deprecated in C:\Users\Lexy Feito\Desktop\xampp\php\pear\MDB2.php on line 1885 Deprecated: Assigning the return value of new by reference is deprecated in C:\Users\Lexy Feito\Desktop\xampp\php\pear\MDB2.php on line 2572

Deprecated: Assigning the return value of new by reference is deprecated in C:\Users\Lexy Feito\Desktop\xampp\php\pear\MDB2.php on line 2595

Deprecated: Assigning the return value of new by reference is deprecated in C:\Users\Lexy Feito\Desktop\xampp\php\pear\MDB2.php on line 2940

Strict Standards: Declaration of MDB2_Driver_Common::raiseError() should be compatible with & PEAR::raiseError($message = NULL, $code = NULL, $mode = NULL, $options = NULL, $userinfo = NULL, $error_class = NULL, $skipmsg = false) in C:\Users\Lexy Feito\Desktop\xampp\php\pear\MDB2.php on line 990

Could somebody tell me what is the correct way of using MDB2.php to connect to MySQL and why I'm getting this errors?

Amal Murali
  • 75,622
  • 18
  • 128
  • 150
Lexy Feito
  • 280
  • 1
  • 8
  • 19

1 Answers1

4

If you look at those "errors", you will see that they are actually just warnings about old-fashioned ("deprecated" means "discouraged and planned for removal in some future version") or badly-written ("strict standards" just means "could be improved") code in the library.

The code will carry on running just fine. However, if this library is not currently maintained, you may find that in future you have to either make major changes to it yourself, or move away to a more modern library.

Check out the error_reporting ini setting and error_reporting() function for how to change which types of messages are displayed or logged.

IMSoP
  • 89,526
  • 13
  • 117
  • 169
  • "The code will carry on running just fine."... But for how long??? As you said this kind of coding is "discouraged and planned for removal in some future version"... – inemanja Sep 21 '14 at 23:36
  • 1
    @inemanja Well, yes, but this is 3rd-party code, so right now the answer to "what is the correct way of using MDB2.php" is to ignore these messages, unless you want to take a lead in refactoring the code to work with later PHP versions. I will edit in a note, however, that if nobody updates the library, it will stop working in future, so may not be a good long-term bet if it doesn't look actively maintained. – IMSoP Sep 22 '14 at 08:13