Having an issue with my code, it's strange because the exact same code works in another .php file but not in this one for whatever reason. I get the error:
Notice: Use of undefined constant logged - assumed 'logged' in ... on line 54
The code below is where the error is said to be. At the IF statement. The second piece of code in tags is the function. It's stored in a separate file 'functions.php'.
<?php
include 'functions.php';
$logged = @logged_in($_SESSION['uuid']);
if(logged==true){
echo 'logged in';
}
?>
<?php
function logged_in($uuid){
$servername="localhost";
$dbusername="root";
$dbpassword="usbw";
$database="randomfacts";
$link=mysql_connect($servername,$dbusername,$dbpassword);
if(! $link){
die('Connection Failed'.mysql_error());
}
mysql_select_db($database,$link);
$query = "SELECT * FROM users WHERE uuid='$uuid'";
$rows = mysql_query($query) or die(mysql_error());
$count = mysql_num_rows($rows);
if($count==0){
return false;
}else{
return true;
}
mysql_close($link);
}
?>