is it a good coding style to define all tables and columns names with a constant and then using them in a query string? i'm doing so, because whenever I change something in my database, I can simply change constant value instead of changing everything. for example here is my database definitions in a separate file:
define("DB_TBL_USER", "user");
define("DB_USER__PK_USER_ID", "pk_user_id");
define("DB_USER__PASSWORD", "password");
define("DB_USER__EMAIL", "email");
define("DB_USER__FIRST_NAME", "first_name");
define("DB_USER__LAST_NAME", "last_name");
define("DB_USER__GENDER", "gender");
and in my database class i built query like this (in register_user() method!):
$queries[]="INSERT INTO ".
constant('DB_TBL_USER'). " ( ".
constant('DB_USER__PASSWORD').",".
constant('DB_USER__EMAIL').",".
constant('DB_USER__FIRST_NAME').",".
constant('DB_USER__LAST_NAME').",".
constant('DB_USER__GENDER').") ".
"VALUES ("."
$password,
$email,
$first_name,
$last_name,
$gender
";
and then putting other queries in queries[] array and executing them with a loop.
is there any simpler and more efficient way to do so?