In the code below how come in the function is has $err, $id but in the place it loads the function it has mysql_connect”, $sql_id. I thought they have to be the same???
Also what does the @ do before hte mysql and finaly how come the code is connecting like this. the $sql show errors is a function to say whether errors are shown or not and that is usually set to 1 to say show the errors so does it mean the same as
[code=php]
if {$sql_show_errors = 1) { ShowErrorMsg(“mysql_connect”, $sql_id) }
but what does the $sql_id bit mean as there is no variable by that in the document? what is it doing
[code=php]
if (!($sql_id = @mysql_connect($SQL_HOST, $SQL_USER, $SQL_PWD))) {
if ($SQL_SHOW_ERRORS <> 0) ShowErrorMsg(“mysql_connect”, $sql_id);
}
// the ShowErrorMsg Function
function ShowErrorMsg($err, $id) {
switch ($err) {
case “mysql_connect”:
$msg[1] = “Couldn’t connect to MySQL server”;
$msg[3] = “Check if the name of the MySQL server, user name & password specified in CompuCLICK.php are correct!”;
break;
if (@mysql_error($id) <> “”) {
$msg[2] = @mysql_error($id);
} else {
$msg[2] = “Unknown”;
}
die(“<hr><font color=”#ff0000″><b>” . $msg[1] . “</b><br>Reason: ” . $msg[2] . “<p></p>” . $msg[3] . “</font><hr><br>”);
}
Also what is better
[code=php]
//using vairbales
$SQL_USERNAME = “k0r54”;
//or a define
define(“SQL_USERNAME”, “k0r54”);
what is the difference.
Sorry about all the Q
Thanks
k0r54