webster2001 Posted March 29, 2008 Share Posted March 29, 2008 I keep getting this error: Fatal error: Call to a member function query() on a non-object in /home/*****/public_html/yourbusiness.php on line 46 This is line 46 $bf=$db->query("SELECT * FROM bf WHERE bfTO={$ir['business']}",$c); Its mccodes v2 if u havent realised cheers! EDIT: Here is the lines above and below function index() { global $ir,$c,$userid,$h,$bdata; $bf=$db->query("SELECT * FROM bf WHERE bfTO={$ir['businesses']}",$c); $fr=mysql_num_arrays($bf); $be=$db->query("SELECT * FROM be WHERE beTO={$ir['business']}",$c); $en=mysql_num_rows($be); Quote Link to comment Share on other sites More sharing options...
Guest Anonymous Posted March 29, 2008 Share Posted March 29, 2008 Re: HELP!!!!!!!!!!!!!! Call to a member function query() on a non-object would indicate that $db is not initialized. Maybe posting a few more lines of code either side of this line would help... My guess is (for a V2 system) you've forgotten to declare $db as global - i.e. global $db; Quote Link to comment Share on other sites More sharing options...
Miniman Posted March 29, 2008 Share Posted March 29, 2008 Re: HELP!!!!!!!!!!!!!! There will be a line of code somewhere above that, It should look something like this.... global $ir,$c,$userid; Modify it to look like this..... global $ir,$c,$userid,$db; Quote Link to comment Share on other sites More sharing options...
webster2001 Posted March 29, 2008 Author Share Posted March 29, 2008 Re: HELP!!!!!!!!!!!!!! There will be a line of code somewhere above that, It should look something like this.... global $ir,$c,$userid; Modify it to look like this..... global $ir,$c,$userid,$db; Ive done that but now i get this error: QUERY ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Query was SELECT * FROM bf WHERE bfTO= The code is now like this: function index() { global $ir,$c,$userid,$db,$h,$bdata; $bf=$db->query("SELECT * FROM bf WHERE bfTO={$ir['business']}",$c); $fr=mysql_num_rows($bf); $be=$db->query("SELECT * FROM be WHERE beTO={$ir['business']}",$c); $en=mysql_num_rows($be); Any one help? Tell me how you fix it and ill give you 10 credits Quote Link to comment Share on other sites More sharing options...
Guest Anonymous Posted March 30, 2008 Share Posted March 30, 2008 Re: HELP!!!!!!!!!!!!!! $bf=$db->query("SELECT * FROM bf WHERE bfTO='{$ir['business']}'",$c); $fr=mysql_num_rows($bf); $be=$db->query("SELECT * FROM be WHERE beTO='{$ir['business']}'",$c); $en=mysql_num_rows($be); Perhaps? Since you have not provided the data definition of either table - I have no idea what type of data $ir['business'] is. Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted March 30, 2008 Share Posted March 30, 2008 Re: HELP!!!!!!!!!!!!!! Remmember your using v2. You could try: $bf=$db->query("SELECT * FROM bf WHERE bfTO=[color=red]'[/color]{$ir['business']}[color=red]'[/color]"); $fr=mysql_num_rows($bf); $be=$db->query("SELECT * FROM be WHERE beTO=[color=red]'[/color]{$ir['business']}[color=red]'[/color]"); $en=mysql_num_rows($be); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.