Jump to content
MakeWebGames

Recommended Posts

Posted

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);
Guest Anonymous
Posted

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;

Posted

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;

Posted

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

Guest Anonymous
Posted

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.

Posted

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);

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...