Hi everyone, i have some code that proccesses a login form. i have an object $DB which works only in SOME areas, this is the code: <?php require_once("Include.php"); global $DB; $Username= $_REQUEST['Username']; $Password= $_REQUEST['Password']; $SQL=" SELECT * FROM members WHERE Username='$Username' AND Password='$Password'; "; $DB->Query($SQL); $UserInfo=$DB->QueryInfo("Array"); if($UserInfo==0) $Login="FALSE"; else $Login="TRUE"; //Make Sure the user is not a duplicate user trying to log in again if($Login="TRUE") { global $DB; $RL="__"; $LoginD="__"; $ID=$UserInfo['ID']; echo $ID; $DB="membersp"; $SQL="SELECT ID FROM membersonline WHERE ID='$ID' "; $DB->Query($SQL); $CheckFD=$Result; if($CheckFD!=0) $LoginD="TRUE"; else $LoginD="FALSE"; if($LoginD=="TRUE") { $RL="TRUE"; //code to allow user onto next page without interfering with the security measures $DB="membersp"; $SQL="SELECT * FROM membersonline WHERE ID=$ID"; DBConnect($DB,$SQL); $Slide=$Result; $NextCode=$Slide['NextCode']; } if($LoginD=="FALSE") { // Now we start to create and write the data that will let other pages know if the user is logged in or not $Seed= rand(); srand($Seed); $NextCode= rand(); $PageNumber="1"; $DB="membersp"; $SQL="INSERT INTO MembersOnline (ID, Seed, PageNumber, NextCode) VALUES ('{$ID}', '$Seed', '$PageNumber', '$NextCode') "; DBConnect($DB,$SQL); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <?php Init(2); ?> <title></title> </head> <body> <?php if($Login=="FALSE") echo("<p class='error'>Login failed, wrong username and/or password please <a href='Login.php'>Try Again</a> or <a href=' Register.php'>Register</a></p>"); if(@$RL=="TRUE") echo("<p class='error'>You have already logged in, click <a href='Projects.php?Code={$NextCode}'>Here</a> to go on</p>"); ?> </body> </html> i get an error saying: *Fatal error*: Call to a member function Query() on a non-object in * D:\Apache\Apache(re)\Apache2\htdocs\LoginP.php* on line *21* but before line 21 i use $DB and it works fine, but line 21 is a problem, any help appreciated