Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8780203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:59:00+00:00 2026-06-13T19:59:00+00:00

I am writing a script to install the database of an application in php.

  • 0

I am writing a script to install the database of an application in php. It working fine but when im trying to install a database that doesnt exist i want only my own error message but i keep getting the default Warning : Warning: mysqli::mysqli() [mysqli.mysqli]: (HY000/2005): Unknown MySQL server host ‘kasdasd’.

So I know that the host is wrong and I want it to be so, with only my own errormessage. How do I get rid of this message?

My connectclass with parameter DBConfig $config:

    $this->mysqli = new mysqli($config->m_host,
                                $config->m_user,
                                $config->m_passw,
                                $config->m_db);

    if ($this->mysqli->connect_error) {
        return false;
    }

    $this->mysqli->set_charset("utf8");

    return true;    
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:59:01+00:00Added an answer on June 13, 2026 at 7:59 pm

    an easy solution would be to see if you can open the hostname using fsockopen and suppressing the errors:

    $port = 80;
    
    if($fp = @fsockopen($config->m_host,$port)){
        $db = new mysqli($config->m_host,$config->m_user,$config->m_passw,$config->m_db);
    }else{
        echo 'hostname not recognized';
    }
    @fclose($fp);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing an install script that installs all tables, stored procedures, views, full
I have a NSIS script that is working well for a large application. I
I'm writing a script that will install some of the optional postgresql modules. Is
I am currently writing a script that will basically ‘install’ a codeigniter installation automatically.
In writing an install script, I quickly found that I'd have cross-platform issues, and
currently I'm making a forum software, and I'm writing the install script, that sets
I'm writing a shell script that allows you to install an .apk on all
I'm writing an install script in bash for an application on Linux. This script
I'm writing a batch script that needs to install Microsoft Lync if the user
I'm writing a big script for a server install, and I want it to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.