Explore your Imagination

Blog of Joeby Zaldivar Keep in touch…


How to Connect MySQL DB on PHP

// Database Constants

// Checks whether a given named constant exists   if   null then it define the given constant variable.
defined('DB_SERVER') ? null : define("DB_SERVER", "localhost");
defined('DB_USER')   ? null : define("DB_USER", "root");
defined('DB_PASS')   ? null : define("DB_PASS", "password");
defined('DB_NAME')   ? null : define("DB_NAME", "my_db");
$connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS);
if (!$connection) {
die("Database connection failed: " . mysql_error());
} else {
$db_select = mysql_select_db(DB_NAME, $this->connection);
if (!$db_select) {
die("Database selection failed: " . mysql_error());



Comments (24) Trackbacks (0)
  1. thanks for sharing such wonderful information…keep posting more such articles…http://www.listasegmentada.com

  2. i am following your blog regularly and got great information. i really like the tips you have given. thanks a lot for sharing. will be referring a lot of friends about this.http://www.kitsucesso.com

  3. Well I sincerely enjoyed studying it. This subject offered by you is very useful for accurate planning.

  4. Graças amigo.

  5. love the site, very nice and meaningful, keep it up.http://www.jogosdocartoon.net

  6. heya..thanks for the post and great tips…i think that hard work is the most important aspect of getting success.http://www.magiccampusbrasil.net

  7. this was awsome!! i’ve been reading them for days now. and i will continue reading your other posts.http://www.impressorashp.org

  8. hey great stuff, thank you for sharing this useful information.http://www.papycom.com

  9. this was awsome!! i’ve been reading them for days now. and i will continue reading your other posts.http://www.facebookbox.com

  10. Post informativo Nice. Outro conhecimento.

  11. I was reading some of your articles on this site and I conceive this web site is really informative ! Retain putting up.

  12. hey there and thank you for your information – I’ve certainly picked up something new from right here. I did however expertise a few 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 slow loading instances times will very frequently affect your placement in google and can damage your quality score if ads and marketing with Adwords. Anyway I am adding this RSS to my email and could look out for a lot more of your respective fascinating content. Ensure that you update this again very soon.

    • hi there, its takes low to load because it was hosted in a free web hosting… i don’t have enough money support this stuff…

  13. What’s up friends, its enormous piece of writing concerning educationand completely defined, keep it up all the time.

  14. hey there, i liked you blog, it is kinda good. keep up the work.http://www.capaharealty.com

  15. I blog often and I genuinely thank you for your content. Your article has
    really peaked my interest. I will take a note of your site and keep
    checking for new details about once a week. I subscribed to your Feed too.

  16. Great beat ! I would like to apprentice at the same time as you amend your website,
    how could i subscribe for a weblog site? The account aided me
    a acceptable deal. I were tiny bit acquainted of this your broadcast offered shiny transparent idea

  17. I’m 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? Anyway keep up the nice quality writing, it is rare to see a nice blog like this one today.

  18. Hi my name is Johnny and i like your blog. It is very nice. The design is jus stunning.

  19. Just wanna comment on few general things, The website design is perfect, the content material is real superb. “To imagine is everything, to know is nothing at all.” by Anatole France.

  20. There’s noticeably a bundle to learn about this. I assume you made sure nice factors in features also.

  21. Amazing blog! Do you have any tips for aspiring writers?
    I’m hoping to start my own blog soon but I’m a little lost on everything.

    Would you advise starting with a free platform like WordPress or
    go for a paid option? There are so many options out there that I’m completely confused .. Any ideas? Thank you!

Leave a comment


No trackbacks yet.