Fork me on GitHub

Fatal error: Call to a member function on a non-object  Bottom

  • I've been using this third party Nascar stats module for a couple years and out of the blue it errors out. After reading many posts here, I've installed PN 7.6.4 and still the same error. Thought it may have something to do with a PHP 5 upgrade, but my host put me back to PHP 4.4.# and same error. Maybe one of you can take a look here and shoot me an idea. Thanks for reading.

    Error is Fatal error: Call to a member function on a non-object in .../public_html/modules/NS-Nascar/pndivisionsapi.php on line 181

    Code

    function Nascar_divisionsapi_get_topic($args){
    extract($args);
            // Get datbase setup - note that both pnDBGetConn() and pnDBGetTables()
        // return arrays but we handle them differently.  For pnDBGetConn()
        // we currently just want the first item, which is the official
        // database handle.  For pnDBGetTables() we want to keep the entire
        // tables array together for easy reference later on
        list($dbconn) = pnDBGetConn();
        $pntable = pnDBGetTables();

        // It's good practice to name the table and column definitions you
        // are getting - $table and $column don't cut it in more complex
        // modules
        $topicstable = $pntable['topics'];
        $topicscolumn = &$pntable['topics_column'];
            $query = "SELECT $topicscolumn[tid],
                         $topicscolumn[topicname],
                         $topicscolumn[topicimage],
                         $topicscolumn[topictext]
                  FROM $topicstable
                  WHERE $topicscolumn[tid]=$topic"
    ;
            $result = $dbconn->Execute($query);
    LINE 181    for(; !$result->EOF; $result->MoveNext() ) {
            list($tid, $tname, $timage, $ttext) = $result->fields;

            $got_topic = array('tid' => $tid,
                                'tname' => $tname,
                                'timage' => $timage,
                                'ttext' =>$ttext);
            }

        return $got_topic;
    }
    ?>
  • That's simple,
    your query have 0 results.


    print the query with

    Code

    die($query);

    and see if your WHERE clause is bad ($topic can be null, so: no results)

    --
    - Mateo T. -
    Mis principios... son mis fines
  • Okay, returned this using the die($query)

    SELECT nuke_topics.pn_topicid, nuke_topics.pn_topicname, nuke_topics.pn_topicimage, nuke_topics.pn_topictext FROM nuke_topics WHERE nuke_topics.pn_topicid=

    topic id isn't being returned.




    edited by: Jbrown, Sep 14, 2007 - 12:24 PM

This list is based on users active over the last 60 minutes.