I have this file called db.php which makes the connection to the database.
<?php
define("DB_HOST", "localhost");
define("DB_NAME", "login");
define("DB_USER", "admin");
define("DB_PASS", "123");
mysql_connect(DB_HOST, DB_USER, DB_PASS) OR die("Falha na ligação.");
?>
What I wanted to do is to use that DB_NAME define in another file so that I just need to change it in the db.php in case I have to change the database name.
Here's an example of where I want it to be aplied.
$qp = "UPDATE login.users SET palpiteatual = '".$_POST['atextfield']."' WHERE user_name = '".$_SESSION['user_name']."'";
Instead of having login.users, I tried this following ways without succeeding.
$qp = "UPDATE '"DB_NAME"'.users SET palpiteatual = '".$_POST['atextfield']."' WHERE user_name = '".$_SESSION['user_name']."'";
$qp = "UPDATE "+DB_NAME+".users SET palpiteatual = '".$_POST['atextfield']."' WHERE user_name = '".$_SESSION['user_name']."'";
Not sure how is the exact syntax to use it this way. Thanks in advance