tags:

views:

488

answers:

2

Why won't this work? I keep getting that error. // Setup forum topics, post count and last post xxxxx

     $query = array(
      'SELECT' => 't.subject',
      'FROM'  => 'topics AS t, pbb_forums AS f',
      'WHERE'  => 't.last_post_id = f.last_post_id');

     $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);

     $forum_page['item_body']['info']['topics'] = '<li class="info-topics"><strong>'.forum_number_format($cur_forum['num_topics']).'</strong> <span class="label">'.(($cur_forum['num_topics'] == 1) ? $lang_index['topic'] : $lang_index['topics']).'</span></li>';
     $forum_page['item_body']['info']['posts'] = '<li class="info-posts"><strong>'.forum_number_format($cur_forum['num_posts']).'</strong> <span class="label">'.(($cur_forum['num_posts'] == 1) ? $lang_index['post'] : $lang_index['posts']).'</span></li>';

     if ($cur_forum['last_post'] != '')
      $forum_page['item_body']['info']['lastpost'] = '<li class="info-lastpost"><span class="label">'.$lang_index['Last post'].'</span> <strong><a href="'.forum_link($forum_url['post'], $cur_forum['last_post_id']).'">'.$result['subject'].'</a></strong> <cite>'.sprintf($lang_index['Last poster'], forum_htmlencode($cur_forum['last_poster'])).'</cite></li>';
     else
      $forum_page['item_body']['info']['lastpost'] = '<li class="info-lastpost"><strong>'.$lang_common['Never'].'</strong></li>';
+1  A: 

You're trying to use a mysqli result ($result) as an array without calling fetch_array on it.

Whatever framework you're using will probably provide a wrapper for this.

Greg
Fatal error: Call to undefined function fetch_array()I've added this line to it:$result = $forum_db->query_build($query) or error(__FILE__, __LINE__); $result = fetch_array($result);
William
It won't be just "fetch_array" but what it is depends on what framework you're using
Greg
A: 

Well, you seem to have "something" (maybe $result ?) as an object ; and you are using everything as arrays.

Maybe you have a way to fetch data as arrays, and not objects ? (Might be a way with the class you are using ? )

Or, you need to access data as objects, and not arrays ; maybe $result->subject, and not $result['subject'] would do ?

Pascal MARTIN