Page 1 of 1

Recent with recent Blogs added

Posted: 8. April 2015 13:17
by brut.me
Hello, so I started working on recent Blogs. I am totalle newbie in php, but I am trying to add a forth row in recent block with a list of new blogs. It is enough for my needs now. But it shows me some error. I know that is something with bad table, but how can I repair it? My new code in Recent

Code: Select all

//
		// Recent blogs
		//
		$sql = 'SELECT blog_subject, user_id, blog_id
			FROM ' . BLOGS . ' t
			WHERE blog_deleted = 0
				AND blog_approved = 1
				' . $sql_where . '' .  $forum_sql . '
			ORDER BY blog_time DESC';
		$result = $db->sql_query_limit($sql, $config['board3_max_topics_' . $module_id]);

		while(($row = $db->sql_fetchrow($result)) && ($row['blog_subject']))
		{
			// auto auth
			if (($auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0'))
			{
				$template->assign_block_vars('latest_topics', array(
					'TITLE'			=> character_limit($row['topic_title'], $config['board3_recent_title_limit_' . $module_id]),
					'FULL_TITLE'	=> censor_text($row['topic_title']),
					'U_VIEW_TOPIC'	=> append_sid("{$phpbb_root_path}blog.$phpEx", 'u=' . $row['user_id'] . '&b=' . $row['blog_id'])
				));
			}
		}
		$db->sql_freeresult($result);
and this is the error:

Code: Select all

SQL ERROR [ mysqli ]

Table 'phpbb_db.blogs' doesn't exist [1146]

SQL

SELECT blog_subject, user_id, blog_id FROM BLOGS t WHERE blog_deleted = 0 AND blog_approved = 1 AND forum_id <> 145 ORDER BY blog_time DESC LIMIT 10

BACKTRACE

FILE: (not given by php)
LINE: (not given by php)
CALL: msg_handler()

FILE: [ROOT]/includes/db/dbal.php
LINE: 757
CALL: trigger_error()

FILE: [ROOT]/includes/db/mysqli.php
LINE: 189
CALL: dbal->sql_error()

FILE: [ROOT]/includes/db/mysqli.php
LINE: 231
CALL: dbal_mysqli->sql_query()

FILE: [ROOT]/includes/db/dbal.php
LINE: 170
CALL: dbal_mysqli->_sql_query_limit()

FILE: [ROOT]/portal/modules/portal_recent.php
LINE: 179
CALL: dbal->sql_query_limit()

FILE: [ROOT]/portal.php
LINE: 120
CALL: portal_recent_module->get_template_center()
How can i write the table correct? can someone double chack it, if the other changes are good ?