Explore your Imagination

Blog of Joeby Zaldivar Keep in touch…

9Mar/1224

How to Connect MySQL DB on PHP

<?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());
}
}
}

 

?>

8May/110

The Truth

Bakit kaya ang pinoy mahilig mangutang.. saka ang bilis bilis pa. Kung bayaran na, mahirap hagilapin, siya pa ang galit... Minsan kw na lng mahiya na nagpautang. Haiks...... Pinoy nga talaga. Magabago na tayo.

 

Bakit kaya pag-oras ng trabaho nakaka-antok? Pero,  pag oras naman ng tulugan hindi na-aantok... Baki kaya? Hirap noh..?

 

 

Filed under: Truth No Comments