Call undefined function mysqli_connect()
Results 1 to 5 of 5

Thread: Call undefined function mysqli_connect()

  1. #1
    Junior Member
    Join Date
    Jun 2015

    Call undefined function mysqli_connect()

    I am a newbie, and I have just learned some knowledges about php
    Today I tried using some command to work with database MySQL
    In editor of phpdesigner, I typed this code:


    // Create connection
    $db = mysqli_connect("localhost", "booksdb", "TABLEname") or die(mysqli_connect_error());

    // Check connection
    if (mysqli_connect_errno()) {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();


    but when Ctrl + F9 to compile, It show error: Fatal error: Call undefined function mysqli_connect()

    I saw some questions same me asked on stackoverlow, some ones said the reason is extension mysql has't been enabled yet. But I don't know how to to that ? ( I also setuped Xampp and Vertrigo )

    So I need a suggestion from other members

    Thanks for reading

  2. #2
    Join Date
    Jun 2005
    Run phpinfo to see if MySQLi is on the list of extensions

    Make page with
    PHP Code:
    And run it.
    If MySQLi is enabled it should be on the long list.
    Apache-2.4.28 (Win64) / PHP-7.1.10 / MySQL-5.7.19 / phpMyAdmin-4.7.4

  3. #3
    PHP Witch laserlight's Avatar
    Join Date
    Apr 2003
    Quote Originally Posted by m4u_hoahoctro
    some ones said the reason is extension mysql has't been enabled yet. But I don't know how to to that ? ( I also setuped Xampp and Vertrigo )
    What version of PHP was installed using XAMPP? What operating system are you using? According to the PHP manual's entry on MySQLi Installation:
    On Windows, for PHP versions 5.3 and newer, the mysqli extension is enabled and uses the MySQL Native Driver by default. This means you don't need to worry about configuring access to libmysql.dll.
    If you are not on Windows, then you should look at your php.ini file to find the appropriate configuration setting.
    Use Bazaar for your version control system
    Read the PHP Spellbook
    Learn How To Ask Questions The Smart Way

  4. #4
    High Energy Magic Dept. NogDog's Avatar
    Join Date
    Aug 2006
    It could be that PHPDesigner's syntax checking uses a different instance of a PHP installation. You may want to check its configuration to see what it's using and if it can be reconfigured to use the version you have installed under XAMPP. Maybe the quickest way to check that would be to create a simple script that just does the mysqli_connect(), put it in the web root directory configured for XAMPP, make sure XAMPP is up and running, then launch the script directly from your browser via http://localhost/name_of_script.php. If that works okay, then I suspect the culprit is PHPDesigner.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  5. #5
    Senior Member cluelessPHP's Avatar
    Join Date
    Apr 2015
    Not used that connection type much but I thought it required server, username, password and database as seen in the below example

    PHP Code:

    // Create connection
    $db mysqli_connect("localhost""booksdb","my password""my database") or die(mysqli_connect_error());

    // Check connection
    if (mysqli_connect_errno()) {
    "Failed to connect to MySQL: " mysqli_connect_error();


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts