get server config? repetitive boring work
Posted: 2019-09-03 23:16
Can anyone share a way of passing global variables? is there a way for me to get the server config from config.php to initiate db connection? I have several fpdf outputs and so when i use my local server this is what one of the files look like
and when i upload to the server is :
and so I have to replace the following code for 25 files.
Is there a way to retrieve that info with global variables? user, pass, and dbname
thank you
Code: Select all
$con = mysqli_connect('localhost','root','');
mysqli_select_db($con,'coachrubens');
//get medidas data
set_time_limit(0);
ini_set('memory_limit', '-1');
$getvariable = $_GET['id'];
$query0 = mysqli_query($con,"select * from medidascomp where ID= '{$getvariable}'");
$medidas0 = mysqli_fetch_array($query0);
Code: Select all
$con = mysqli_connect('localhost','user','pass');
mysqli_select_db($con,'onlinedb');
//get medidas data
set_time_limit(0);
ini_set('memory_limit', '-1');
$getvariable = $_GET['id'];
$query0 = mysqli_query($con,"select * from medidascomp where ID= '{$getvariable}'");
$medidas0 = mysqli_fetch_array($query0);
and so I have to replace the following code for 25 files.
Code: Select all
$con = mysqli_connect('localhost','user','pass');
mysqli_select_db($con,'onlinedb');
Is there a way to retrieve that info with global variables? user, pass, and dbname
thank you