MyBB Community Forums

Full Version: SQL Query not echo'ing in FORUMDISPLAY_THREAD
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all!

I'm trying to add an sql query that echo's the thread poster' IP address on the FORUMDISPLAY_THREAD.

My code is below: (everything that I've added is within the <?php ?>, and I've tested it on a blank page seperate to my mybb site, it works, but not when used here)

<tr>
	<td align="center" class="{$bgcolor}{$thread_type_class}" width="2%"><img src="{$theme['imgdir']}/{$folder}.gif" alt="{$folder_label}" title="{$folder_label}" /></td>
	<td align="center" class="{$bgcolor}{$thread_type_class}" width="2%">{$icon}</td>
	<td class="{$bgcolor}{$thread_type_class}">
		{$attachment_count}
		<div>
			<span>{$prefix} {$gotounread}{$thread['threadprefix']}<a href="{$thread['threadlink']}" class="{$inline_edit_class} {$new_class}" id="tid_{$inline_edit_tid}">

<?php     
$mysqli = mysqli_connect("removed", "removed", "removed", "removed");   
$query = "SELECT mybb_posts.ipaddress FROM mybb_posts INNER JOIN mybb_threads ON mybb_posts.pid=mybb_threads.firstpost WHERE mybb_threads.firstpost='1' ";   
$result = mysqli_query($mysqli,$query); 
while ($row = mysqli_fetch_assoc($result)) { 
echo "[" . $row['ipaddress'] . "]";
} 
?>


{$thread['subject']}</a>{$thread['multipage']}</span>
			<div class="author smalltext">{$thread['profilelink']}</div>
		</div>
	</td>
	<td align="center" class="{$bgcolor}{$thread_type_class}"><a href="javascript:MyBB.whoPosted({$thread['tid']});">{$thread['replies']}</a>{$unapproved_posts}</td>
	<td align="center" class="{$bgcolor}{$thread_type_class}">{$thread['views']}</td>
	{$rating}
	<td class="{$bgcolor}{$thread_type_class}" style="white-space: nowrap; text-align: right;">
		<span class="lastpost smalltext">{$lastpostdate} {$lastposttime}<br />
		<a href="{$thread['lastpostlink']}">{$lang->lastpost}</a>: {$lastposterlink}</span>
	</td>
{$modbit}
</tr>

I get this error:
Quote:Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /removedURL/forumdisplay.php(1123) : eval()'d code on line 16


Do you have the PHP in Templates plugin installed?