Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

changed data vars to defines and changed the method of setting charset

  • Loading branch information...
commit b129a1a9a257cc03ce08b96398349c37bf85ccc7 1 parent d791dc4
@Ddorda authored
Showing with 14 additions and 7 deletions.
  1. +14 −7 config-sample.php
View
21 config-sample.php
@@ -1,15 +1,22 @@
<?php
-//Please fill the details below as asked.
-$db_host = ''; // Your MySQL host address. usually localhost. if you use different port, please use "129.0.0.1:port" (your port after the colon)
-$db_name = ''; // Your MySQL database name. must exist.
-$db_user = ''; // Your MySQL username.
-$db_pass = ''; // Your MySQL password.
+//Please fill the details below as asked and save under "config.php".
+
+// Your MySQL host address. usually localhost. if you use different port, please use "129.0.0.1:port" (your port after the colon).
+define('DB_HOST', 'localhost');
+
+// Your MySQL database name. must exist.
+define('DB_NAME', 'database_name');
+
+// Your MySQL username.
+define('DB_USER', 'your_username');
+
+// Your MySQL password.
+define('DB_PASS', 'your_password');
// DON'T TOUCH!!!
try {
- $con = new PDO("mysql:host=$db_host;dbname=$db_name', $db_user, $db_pass");
- $con->exec('SET CHARACTER SET utf8');
+ $con = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME . ';charset=utf8', DB_USER, DB_PASS);
} catch (PDOException $e) {
print 'Error!: ' . $e->getMessage() . '<br/>';
die();
Please sign in to comment.
Something went wrong with that request. Please try again.