Mysqli Database Connection using class

MySQLi Database Connection using class
  • MySQLi stands for MySQL improved.
  • Its support prepared statement which is very useful.
  • It’s an object-oriented interface to the MySQL structure which is easy to use.
  • connection using mysql.
<?php class MyConncetion { Private $db_name = 'Demo'; Private $db_user = 'root'; Private $db_pass = ''; Private $db_host = 'localhost'; public function connect() { $connect_db = new mysqli($this->db_host, $this->db_user, $this->db_pass, $this->db_name);

        if (mysqli_connect_errno()) {
            printf("Connection failed: %s", mysqli_connect_error());

            exit();
        } else {
            $connection = "Database Connection Establish Successfully";
        }
        return $connection;

    }
}
$obj = new MyConncetion();
$result=$obj->connect();
echo $result;
?>

Result

Database Connection Establish Successfully

80 Replies to “Mysqli Database Connection using class”

  1. I just want to say I am very new to blogs and truly savored you’re web site. More than likely I’m likely to bookmark your website . You amazingly come with superb articles and reviews. Regards for sharing your webpage.

  2. I just want to say I am very new to blogs and truly savored you’re web site. More than likely I’m likely to bookmark your website . You amazingly come with superb articles and reviews. Regards for sharing your webpage.

  3. I really appreciate this post. I’ve been looking all over for this! Thank goodness I found it on Bing. You’ve made my day! Thanks again! dgkeeadeaddd

  4. fantastic post, very informative. I wonder why the other specialists of this sector don’t notice this. You must continue your writing. I’m confident, you have a great readers’ base already!

  5. This design is steller! You definitely know how to keep a reader amused. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Excellent job. I really enjoyed what you had to say, and more than that, how you presented it. Too cool!

  6. hello there and thank you for your info – I’ve definitely picked up anything new from right here. I did however expertise some technical issues using this website, since I experienced to reload the site many times previous to I could get it to load correctly. I had been wondering if your web host is OK? Not that I am complaining, but sluggish loading instances times will often affect your placement in google and can damage your quality score if advertising and marketing with Adwords. Anyway I’m adding this RSS to my e-mail and could look out for much more of your respective intriguing content. Ensure that you update this again soon..

  7. Wonderful blog you have here but I was curious about if you knew of any forums that cover the same topics discussed here? I’d really love to be a part of community where I can get suggestions from other knowledgeable individuals that share the same interest. If you have any recommendations, please let me know. Cheers!

  8. Attractive section of content. I just stumbled upon your web site and in accession capital to assert that I acquire actually enjoyed account your blog posts. Anyway I’ll be subscribing to your feeds and even I achievement you access consistently quickly.

  9. Admiring the dedication you put into your blog and in depth information you present. It’s nice to come across a blog every once in a while that isn’t the same outdated rehashed material. Fantastic read! I’ve bookmarked your site and I’m adding your RSS feeds to my Google account.

  10. Wonderful blog! Do you have any suggestions for aspiring writers? I’m planning to start my own website soon but I’m a little lost on everything. Would you recommend starting with a free platform like WordPress or go for a paid option? There are so many options out there that I’m totally overwhelmed .. Any recommendations? Appreciate it!

  11. Excellent blog here! Also your site a lot up very fast! What web host are you the use of? Can I am getting your associate hyperlink to your host? I wish my web site loaded up as quickly as yours lol

  12. I’m curious to find out what blog platform you happen to be utilizing? I’m having some small security problems with my latest blog and I’d like to find something more secure. Do you have any recommendations?

  13. Its like you learn my thoughts! You appear to know a lot approximately this, such as you wrote the e-book in it or something. I think that you can do with a few p.c. to force the message house a bit, however other than that, this is great blog. An excellent read. I will definitely be back.

  14. Somebody necessarily help to make severely articles I would state. This is the first time I frequented your web page and so far? I amazed with the research you made to make this actual publish amazing. Great job!

  15. Youre so cool! I dont suppose Ive read something like this before. So good to search out any person with some unique ideas on this subject. realy thank you for starting this up. this web site is something that is needed on the internet, somebody with a little originality. useful job for bringing something new to the internet!

  16. Pretty great post. I just stumbled upon your weblog and wished to say that I’ve really enjoyed surfing around your weblog posts. In any case I will be subscribing for your rss feed and I’m hoping you write once more soon!

  17. I really wanted to write down a brief note to say thanks to you for all of the fabulous instructions you are sharing at this website. My extended internet lookup has at the end been compensated with incredibly good facts to go over with my colleagues. I would point out that most of us site visitors actually are really lucky to be in a remarkable community with very many awesome people with interesting guidelines. I feel truly grateful to have seen the web pages and look forward to plenty of more amazing moments reading here. Thank you once more for all the details.

  18. With havin so much content and articleswritten contentcontent do you ever run into any problemsissues of plagorism or copyright violationinfringement? My websitesiteblog has a lot of completely uniqueexclusiveunique content I’ve either authoredcreatedwritten myself or outsourced but it looks likeappearsseems a lot of it is popping it up all over the webinternet without my agreementauthorizationpermission. Do you know any solutionstechniquesmethodsways to help protect againstreducestopprevent content from being ripped offstolen? I’d certainlydefinitelygenuinelytrulyreally appreciate it.

  19. I enjoy you because of every one of your effort on this web site. Kate takes pleasure in making time for investigations and it is obvious why. A number of us know all about the dynamic ways you present useful tactics by means of this website and in addition encourage contribution from other people on this content and our own simple princess is actually becoming educated a lot. Take advantage of the remaining portion of the new year. Your carrying out a superb job.

  20. You’re so interesting! I don’t believe I’ve read something like this before.
    So great to find somebody with a few unique thoughts on this subject matter.
    Really.. thanks for starting this up. This website is one
    thing that is needed on the internet, someone with a little originality!

  21. I enjoy you because of all your valuable work on this site. My mother really loves managing research and it is obvious why. A lot of people learn all regarding the compelling form you convey simple tips and tricks via the blog and even cause participation from some others on the matter plus our favorite child is really understanding so much. Enjoy the remaining portion of the year. You’re the one performing a glorious job.

  22. Whats up! I just wish to give a huge thumbs up for the great information you’ve got right here on this post. I will be coming back to your weblog for extra soon.

  23. Unquestionably believe that which you stated. Your favorite reason appeared to be on the web the easiest thing to be aware of. I say to you, I certainly get annoyed while people consider worries that they plainly don’t know about. You managed to hit the nail upon the top and also defined out the whole thing without having side-effects , people can take a signal. Will probably be back to get more. Thanks

  24. I would like to voice my love for your kindness in support of women who must have help with that subject matter. Your special commitment to passing the solution all through was rather good and has continually empowered regular people much like me to achieve their endeavors. Your own warm and helpful suggestions implies a whole lot to me and somewhat more to my peers. Thanks a lot; from all of us.

  25. I am also commenting to let you understand what a brilliant discovery my cousin’s daughter had reading your webblog. She even learned many issues, most notably how it is like to possess an ideal coaching spirit to make many people without hassle thoroughly grasp several complex subject areas. You actually did more than readers’ expected results. Thank you for displaying such important, safe, explanatory and as well as unique guidance on your topic to Emily.

  26. I am extremely impressed with your writing skills and also with the layout on your weblog. Is this a paid theme or did you modify it yourself? Either way keep up the excellent quality writing, it’s rare to see a nice blog like this one these days..

  27. I wanted to write a message to be able to express gratitude to you for all of the nice points you are giving out on this website. My particularly long internet investigation has at the end been honored with reliable facts to write about with my partners. I ‘d believe that most of us readers are undoubtedly lucky to exist in a useful community with so many brilliant professionals with helpful ideas. I feel truly happy to have encountered your webpages and look forward to so many more fun moments reading here. Thanks once again for a lot of things.

  28. I just wanted to write down a simple comment to say thanks to you for the marvelous tips and tricks you are posting at this site. My particularly long internet research has at the end been recognized with reasonable concept to share with my co-workers. I would express that we website visitors are really lucky to be in a remarkable community with many awesome individuals with useful ideas. I feel extremely blessed to have seen your webpage and look forward to many more enjoyable moments reading here. Thanks a lot once again for everything.

  29. I’ve been having issues with my Windows hosting. It has set me back quite a bit while making the next list. This is the current list that I have. I should add another list in less than a week. I’ll let you all know when the next list is ready. Thank you for your patience.

Leave a Reply

Your email address will not be published. Required fields are marked *