mysql - PHP PDO statement using constants -


so have different file called config.php declares constants using. included config.php in php script coding:

my php script:

    <?php         session_start();         //connection config         include 'config.php';          $con = new pdo('mysql:host="'. db_host .'";dbname="'. db_name .'"', db_user,db_password);     ?> 

in config.php:

<?php define('db_host','localhost');  define('db_name','theclass'); //name of database define('db_user','root'); //mysql user define('db_password',''); //mysql password   ?> 

however, wamp throwing error on $con = new pdo line giving me fatal error. parameter's used in pdo statement correct in terms of format, because i'm not sure if need quotations around db variables.


Comments

Popular posts from this blog

python - Installing PyDev in eclipse is failed -

PHP OOP-based login system -

c# - Nested Internal Class with Readonly Hashtable throws Null ref exception.. on assignment -