Announcement

Collapse
No announcement yet.

Fatal error: Call to a member function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • fixer
    replied
    yup
    it is fixed now

    thanx

    Leave a comment:


  • Marco van Herwaarden
    replied
    Globalizing is making the scope of a variable global, instead of only to the current function. To globalize a variable you can use the following syntax:
    PHP Code:
    global $myvar
    To answer the question in your first post, $db is probably pout of scope in the function where you are using it. Try using $vbulletin->db->query_first instead. If that still don't work, add a 'global $vbulletin;' on a line before this.

    In your second post your are using '$DB_site'. This is vB3.0.x syntax. This is in vB3.5 replaced by '$vbulletin->db'. Also 'query' is not used anymore (although it will still work), and should be replaced by either 'query_read' or 'query_write'.

    Leave a comment:


  • gopherhockey
    replied
    Originally posted by Alan @ CIT
    It means that $db isn't an object.

    If that code is within a function, make sure that $db has been globaled. Alternativly, check if $vbulletin has been globaled, and use $vbulletin->db->query_first(...
    Could you explain the globaled thing?

    Here is a query I have that gives that same error:

    Code:
    $trails=$DB_site->query("SELECT * FROM conditiontrail ORDER BY trailid ASC");

    Leave a comment:


  • Alan @ CIT
    replied
    It means that $db isn't an object.

    If that code is within a function, make sure that $db has been globaled. Alternativly, check if $vbulletin has been globaled, and use $vbulletin->db->query_first(...

    Leave a comment:


  • fixer
    started a topic Fatal error: Call to a member function

    Fatal error: Call to a member function

    it is a script which show the last 10 threads on wherever you want.
    it was working fine on vb3.0.7
    but now it does not.

    i fixed many errors but this one make me crazy

    this is what i ve got:

    Fatal error: Call to a member function query_first() on a non-object in c:\AppServ\www\vb350gold\ana\lastsetup.php on line 1903

    and this is the code of that line

    $childsets = $db->query_first("
    SELECT styleid, title, parentlist
    FROM " . TABLE_PREFIX . "style
    WHERE parentid = $styleid
    ");

Related Topics

Collapse

  • cymode
    Fatal Error method.php on line 170
    by cymode
    Code:
    Fatal error: Uncaught exception 'Exception' with message 'invalid_query_parameters for getHelpLength' in /...../htdocs/forum/core/vb/db/query/method.php:170 Stack trace: #0 /....../htdocs/forum/core/vb/db/assertor.php(263):
    ...
    Sat 6 Oct '12, 12:25am
Working...
X