2012-05-22, 04:39 PM
(2012-05-22, 05:26 AM)Cyberuben Wrote: I am trying to use PHP to call something from the database, find a SteamID, search this in another table and put it out.
This is my current code:
For some reason the PHP doesn't work.{$ignore_bit} <a name="pid{$post['pid']}" id="pid{$post['pid']}"></a> <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="{$post_extra_style} {$post_visibility}" id="post_{$post['pid']}"> <tbody> <tr> <td class="tcat"> <div class="float_left smalltext"> {$post['postdate']}, {$post['posttime']} <span id="edited_by_{$post['pid']}">{$post['editedmsg']}</span> </div> {$post['posturl']} </td> </tr> <tr> <td class="trow1 {$unapaproved_shade}"> <table cellspacing="0" cellpadding="0" border="0" style="width: 100%;"> <tr> <td class="post_avatar" width="1" style="{$post['avatar_padding']}"> {$post['useravatar']} </td> <td class="post_author"> <strong><span class="largetext">{$post['profilelink']}</span></strong> {$post['onlinestatus']}<br /> <span class="smalltext"> {$post['usertitle']}<br /> {$post['userstars']} {$post['groupimage']} </span> </td> <td class="smalltext post_author_info" width="165"> {$post['user_details']} </td> </tr> </table> </td> </tr> <tr> <td class="trow2 post_content {$unapproved_shade}"> <span class="smalltext"><strong>{$post['subject']} | {$GLOBALS['threadfields']['b_reason_short']}<br />{$post['subject_extra']}</strong></span> <div class="post_body" id="pid_{$post['pid']}"> <table cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="{$post_extra_style} {$post_visibility}" id="post_{$post['pid']}"> <tr> <td class="trow1" valign="top" width="25%"><strong>Name: </strong></td><td class="trow1" valign="top" width="75%">{$post['subject']}</td> </tr> <tr> <td class="trow2" valign="top" width="25%"><strong>SteamID: </strong></td><td class="trow2" valign="top" width="75%">{$GLOBALS['threadfields']['b_steamid']}</td> </tr> <tr> <td class="trow1" valign="top" width="25%"><strong>Reason to be banned (short): </strong></td><td class="trow1" valign="top" width="75%">{$GLOBALS['threadfields']['b_reason_short']}</td> </tr> <tr> <td class="trow2" valign="top" width="25%"><strong>Reason to be banned: </strong></td><td class="trow2" valign="top" width="75%">{$GLOBALS['threadfields']['b_reason']}</td> </tr> <tr> <td class="trow1" valign="top" width="25%"><strong>Evidence: </strong></td><td class="trow1" valign="top" width="75%">{$GLOBALS['threadfields']['b_evidence']}</td> </tr> <tr> <td class="trow2" valign="top" width="25%"><strong>Note to moderator: </strong></td><td class="trow2" valign="top" width="75%">{$GLOBALS['threadfields']['b_note']}</td> </tr> <tr> <td class="trow1" valign="top" width="25%"><strong>Previous bans: </strong></td><td class="trow1" valign="top" width="75%"> <?php $SQLquery = " SELECT b_steamid FROM mybb_threadfields_date WHERE tid = '" . mysql_real_escape_string($_GET['tid']) . "' "; $resultaat = mysql_query($SQLquery) or die(mysql_error()); if(mysql_num_rows($resultaat) == 1) { $SQLquery = " SELECT CONCAT('toggle[ban_', banid, ']') AS db_banid, name, steamid, banlength FROM excl_bans WHERE steamid = '" . mysql_result($resultaat, 0, 'b_steam_id') . "' "; $resultaat = mysql_query($SQLquery) or die(mysql_error()); if(mysql_num_rows($resultaat) > 0) { ?> <div id="banlist"> <div> <table width="100%" cellspacing="0" cellpadding="0" align="center" class="listtable"> <tr> <td width="14%" height="16" class="listtable_top" align="center"><b>Date</b></td> <td height="16" class="listtable_top"><b>Name</b></td> <td width="20%" height="16" class="listtable_top"><b>Admin</b></td> <td width="10%" height="16" class="listtable_top" align="center"><b>Length</b></td> </tr> </table> </div> <?php while ($rows = mysql_fetch_assoc($resultaat)) { echo "<a href=\"#\" rel=\"". $rows['db_banid'] . "\"><div>\n"; echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" class=\"listtable\">\n"; echo "<tr class=\"tbl_out\" onmouseout=\"this.className='tbl_out'\" onmouseover=\"this.className='tbl_hover'\">\n"; echo "<td width=\"14%\" height=\"16\" align=\"center\" class=\"listtable_1\">". $rows['banlength'] . "</td>\n"; echo "<td height=\"16\" class=\"listtable_1\">". $rows['name'] . "</td>\n"; echo "<td width=\"20%\" height=\"16\" class=\"listtable_1\">Excl</td>\n"; echo "<td width=\"10%\" height=\"16\" align=\"center\" class=\"listtable_1\">". $rows['banlength'] . "</td>\n"; echo "</tr>\n"; echo "</table>\n"; echo "</div></a>\n"; echo "<div id=\"ban_". $rows['banid'] . "\" align=\"center\">\n"; echo "<table width=\"80%\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" class=\"listtable\">\n"; echo "<tr>\n"; echo "<td width=\"100%\" height=\"16\" class=\"listtable_top\" align=\"center\" colspan=\"2\"><strong>Ban Details</strong></td>\n"; echo "</tr>\n"; echo "<tr class=\"tbl_out\" onmouseout=\"this.className='tbl_out'\" onmouseover=\"this.className='tbl_hover'\">\n"; echo "<td height=\"16\" width=\"20%\" class=\"listtable_1\">Name</td><td width=\"80%\" class=\"listtable_1\">". $rows['name'] . "</td>\n"; echo " </tr>\n"; echo " <tr class=\"tbl_out\" onmouseout=\"this.className='tbl_out'\" onmouseover=\"this.className='tbl_hover'\">\n"; echo "<td height=\"16\" width=\"20%\" class=\"listtable_1\">SteamID</td><td width=\"80%\" class=\"listtable_1\">". $rows['steamid'] . "</td>\n"; echo " </tr>\n"; echo " <tr class=\"tbl_out\" onmouseout=\"this.className='tbl_out'\" onmouseover=\"this.className='tbl_hover'\">\n"; echo " <td height=\"16\" width=\"20%\" class=\"listtable_1\">CommunityID</td><td width=\"80%\" class=\"listtable_1\">546354321354</td>\n"; echo " </tr>\n"; echo " <tr class=\"tbl_out\" onmouseout=\"this.className='tbl_out'\" onmouseover=\"this.className='tbl_hover'\">\n"; echo "<td height=\"16\" width=\"20%\" class=\"listtable_1\">Banlength</td><td width=\"80%\" class=\"listtable_1\">". $rows['banlength'] . "</td>\n"; echo " </tr>\n"; echo "</table>\n"; echo "</div>\n"; } } } ?> </td> </tr> </table> </div> <div class="post_meta" id="post_meta_{$post['pid']}"> {$post['iplogged']} </div> </td> </tr> <tr> <td class="trow1 post_buttons {$unapproved_shade}"> <div class="author_buttons float_left"> {$post['button_email']}{$post['button_pm']}{$post['button_www']}{$post['button_find']} </div> <div class="post_management_buttons float_right">{$post['button_edit']}{$post['button_quickdelete']}{$post['button_quote']}{$post['button_multiquote']}{$post['button_report']}{$post['button_warn']}{$post['button_reply_pm']}{$post['button_replyall_pm']}{$post['button_forward_pm']}{$post['button_delete_pm']} </div> </td> </tr> </tbody> </table>
I get these errors:
Parse error: syntax error, unexpected $end in /home/casualbananas.com/public_html/inc/functions_post.php(645) : eval()'d code(102) : eval()'d code on line 34
Parse error: syntax error, unexpected '}' in /home/casualbananas.com/public_html/inc/functions_post.php(645) : eval()'d code(153) : eval()'d code on line 34
What am I doing wrong?
http://puu.sh/w1gJ
This is what SHOULD happen, one or multiple records (Previous bans field)
First error means you forgot a ; so check all your lines of code, make sure they are on the same line and don't have an ENTER pressed in the middle.
Second error means just remove one of your } at the end of all your PHP, you just have 1 too many.
Official Site: http://mochacoder.com
Coming Soon: http://wowgnerd.com & http://generalrides.com
Follow me on twitter: @MochaCoder
Coming Soon: http://wowgnerd.com & http://generalrides.com
Follow me on twitter: @MochaCoder