Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

PHP fatal error

Options
  • 24-09-2005 11:33am
    #1
    Registered Users Posts: 673 ✭✭✭


    Hey,

    Im getting this error message when im trying to run a tets site:

    'Fatal error: Cannot instantiate non-existent class: mysqli in c:\program files\easyphp1-8\www\myphp\db_fns.php on line 5'

    When i go to that file line 5 is the following:

    $result = new mysqli('localhost', 'root', 'mypassword', 'book_sc');

    Am i getting this error because it isint connecting to the mysql database or something? All the code should be correct because it's staright from a book's source files.


Comments

  • Registered Users Posts: 8,488 ✭✭✭Goodshape


    just a guess, but try taking out the 'i' in 'mysqli'.

    and also, I take it you've changed the username, password and DB name to reflect your own ?


  • Registered Users Posts: 4,003 ✭✭✭rsynnott


    Is there any reason in particular that you're using the mysql improved interface? Most people don't, and few servers support it.


  • Registered Users Posts: 673 ✭✭✭Bananna man


    Im learning php and mysql from the book 'php and mysql for webdevelopment'. the code is directly from the books source cd so im not sure what in the hell is going wrong. And yes, i have changed the username and password :)


  • Registered Users Posts: 4,003 ✭✭✭rsynnott


    Ah, right, you may want to try a different book (or a free online thing should be just as good). The MySQL Improved interface is a nice idea, but currently enjoys almost no support.


  • Registered Users Posts: 673 ✭✭✭Bananna man


    It's a good book "php and mysql web development, by luke welling". At the moment im just testing it on my local apache server, this should handle it ok shouldnt it?


  • Advertisement
  • Registered Users Posts: 673 ✭✭✭Bananna man


    i take it that the username and password are the same as the username & password i use when loggin on to phpMY admin?


  • Registered Users Posts: 4,003 ✭✭✭rsynnott


    Compare http://php.mirrors.esat.net/manual/en/ref.mysql.php
    and http://php.mirrors.esat.net/manual/en/ref.mysqli.php

    The author of the book thinks you should be using the second one, and in an ideal world, he's right. In the real world, however, few servers support the second.

    Now, you should certainly be able to use it on your home computer, though. You may need to compile it yourself, though; see the bit at the top. You may be better just go with plain old mysql_(*).


  • Registered Users Posts: 673 ✭✭✭Bananna man


    Tried it without the 'i' but no still change :mad: Man, i was supposed to be starting a php and mysql course last week but it was cancelled due to lack of interest!!!


  • Closed Accounts Posts: 4 kitfrog


    mysqli is a PHP 5 only extension. Are you running php5?


Advertisement