ok all i have a new problem with this function.
for the reccord the last one worked but since then i realised that my college blocks anything with the word game so i built a all in one site for both my testing server and production server if you need more code just let me know and i will add it
for now i have done this
Code: Select all
//inside config.php
global $servoff,$sqlun,$sqlpass;
$sqlconnection = false;
$servoff = null;
$deverrortitle = null;
$devText = null;
$sqlun = null;
$sqlpass = null;
global $sql, $sql_db;
$servername = $_SERVER['SERVER_NAME'];
switch($servername)
{
case 'serv1.net':
$sql = mysql_connect("localhost","username1", "pass1");
$sql_db = mysql_select_db("db1");
break;
case 'serv2.com':
global $sqlun, $sqlpass;
$sql = mysql_connect("localhost", "username2", "pass2");
$sql_db = mysql_select_db("advancet_college");
break;
}
function connectme($mysqlcheck)
{
global $sqlconnection;
if($mysqlcheck == 0)
{
}
if($mysqlcheck == 1)
{
if(!$sqlconnection)
{
try
{
global $servoff;
echo $sqlun;
$mytest = $sql;
if(!$mytest)
{
throw new Exception('MySQL Connection error: '.mysql_error());
$servoff = 1;
}
else
{
$sqlconnection = true;
$servoff = null;
}
}
catch (Exception $e)
{
global $developer;
global $devText, $deverrortitle;
global $devText, $deverrortitle;
$deverrortitle = "SQL Error";
$devText = "we have this error happening ". $e->getMessage();
}
}
}
}
Code: Select all
//inside index.php
require 'includes/config.php';
connectme($mysqlcheck);
if ($sqlconnection == true)
{
connectdb($servername);
}
if ($servoff == 1)
{
echo "Server is set to ".$servoff;
}
however the $servoff is found in index.php when im coding but when i run php it does not dispay $servoff and it doesnt send $sqlconnection...
few hours in with this problem and still no luck any ideas??
thanks

in advance to all who reply =]=]
also how do i make it so i can do this
Code: Select all
my_sql_connect("localhost",$db_username,$dp_password);
?? i have tried from what my tutor said
Code: Select all
my_sql_connect("localhost",'$db_username','$db_password');
but it fails (im sure its me messing up at 3am but its when i get the time
when