I'm having an issue here I have never seen before...
I have a several PHP files, template.php, db.php and functions.php...db.php and functions.php are included in template.php in that order. When I try to call a function from functions.php, the MySQL query fails with:
When I remove the function and place the code inline instead, it works fine...
Here is the function.
I have a several PHP files, template.php, db.php and functions.php...db.php and functions.php are included in template.php in that order. When I try to call a function from functions.php, the MySQL query fails with:
"Access denied for user 'airfront'@'loc alhost' (using password: NO)"
Here is the function.
Code:
function siteMsg($msg){ // Get the msg
$sql = "SELECT *
FROM siteMessages
WHERE code = '" . $msg . "'";
$result = mysql_query($sql)or die(mysql_error());
$array = mysql_fetch_array($result);
$dString = "<div style='vertical-align: middle; width: 620px; padding-left: 5px; float: left; padding-top: 10px; ";
switch($array['type']){
case "red":
$dString .= "color: #FF0000; ";
$dString .= "font-weight: bold; ";
$dString .= "text-size: 10px; ";
$dString .= "text-align: left; ";
break;
case "green":
$dString .= "color: #009900; ";
$dString .= "font-weight: bold; ";
$dString .= "text-size: 10px; ";
$dString .= "text-align: left; ";
break;
}
$dString .= ">";
$dString .= "<ul style='list-style-type: none; padding: 0px; margin: 0px;'>";
$dString .= " <li style='float: left; padding-left: 0px; width: 40px; display: inline;'><img src='images/alert_" . $array['type'] . ".png' /></li>";
$dString .= " <li style='padding: 0px; width: 570px; display: inline;'>" . $array['msg'] . "</li>";
$dString .= "</ul>";
$dString .= "</div>";
return $dString;
}
Comment