SQL-Abfrage des antwort zählers?
Verfasst: 13.02.2008 14:32
Kann mir einer bei meinem Problem helfen?
Ich möchte das topics_replies Feld der jeweiligen topic_id abfragen und an ein Template weitergeben.
Das ist meine news.php:
und das ist meine template.htm:
Dies ist was ich schon abgeändert habe:
Jedoch kommt immer folgende Ausgabe:
Ich möchte das topics_replies Feld der jeweiligen topic_id abfragen und an ein Template weitergeben.
Das ist meine news.php:
Code: Alles auswählen
<?php
if(file_exists("config.php")) {
include("config.php");
echo "";
}
else {
echo "Config file missing, or incorrect permissions!";
echo "Stopping the rest of the page from loading!";
exit();
}
$queryp1 = "SELECT * FROM " . $table_prefix . "posts WHERE forum_id='" . $forum_id[0] . "'";
$queryp2 = "";
foreach($forum_id as $blaaah) {
if($blaaah == $forum_id[0]) {
echo "";
echo "";
}
else {
$queryp2 .= " OR forum_id='".$blaaah."'";
}
}
$queryp3 = " ORDER BY topic_id DESC, post_id;";
$query = $queryp1.$queryp2.$queryp3;
$result = mysql_query($query);
$num = mysql_num_rows($result);
function replace_bb_code($text)
{
$text = preg_replace('/\:[0-9a-z\:]+\]/si', ']', $text);
$text = preg_replace("#\[b\](.+?)\[/b\]#is", "<b>\\1</b>", $text);
$text = preg_replace("#\[i\](.+?)\[/i\]#is", "<i>\\1</i>", $text);
$text = preg_replace("#\[u\](.+?)\[/u\]#is", "<u>\\1</u>", $text);
$text = preg_replace("#\[s\](.+?)\[/s\]#is", "<s>\\1</s>", $text);
$text = eregi_replace("\\[fvideo\\]([^\\[]*)\\[/fvideo\\]", "<p align=center><object width=425 height=350><param name=movie \"></param><param name=wmode value=transparent></param><embed src=\"\\1\" type=application/x-shockwave-flash wmode=transparent width=425 height=373></embed></object></p>", $text);
$text = eregi_replace("\\[url\\]([^\\[]*)\\[/url\\]", "<a href=\"\\1\" target=\"_blank\">\\1</a>", $text);
$text = eregi_replace("\\[url=([^\\[]+)\\]([^\\[]*)\\[/url\\]", "<a href=\"\\1\" target=\"_blank\">\\2</a>", $text);
$text = eregi_replace("\\[img\\]([^\\[]*)\\[/img\\]", "<img src=\"\\1\">", $text);
$text = eregi_replace("\\[color=([^\\[]+)\\]([^\\[]*)\\[/color\\]", "<font color=\"\\1\">\\2</font>", $text);
$text = eregi_replace("\\[quote\\]([^\\[]*)\\[/quote\\]", "<br><br><strong>Quote:</strong><table width='80%' border='0' cellspacing='0' cellpadding='3'><tr><td bgcolor='#EFEFEF'><font color='#FFFFFF' size='-2'>\\1</font></td></tr></table><br>", $text);
$text = eregi_replace("\\[code\\]([^\\[]*)\\[/code\\]", "<br><br><strong>Code:</strong><table width='80%' border='0' cellpadding='3' cellspacing='0' bgcolor='#FFFFFF' style='border:1px solid gray;'><tr><td bgcolor='#000000'><font color='#009900' size='-2'>\\1</font></td></tr></table><br>", $text);
$text = preg_replace("#\[spoiler\](.+?)\[/spoiler\]#is", "<div style='margin:20px; margin-top:5px'><div class='smallfont' style='margin-bottom:2px'><input src='../hgl/layer/icon_spoiler.gif' type='image' value='Show' style='font-size:10px;margin:0px;padding:0px;' onClick=\"if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }\"></div><div class=alt2 style='margin: 0px; padding: 6px; border:0;'><div style='display: none;'>
\\1</div></div></div>", $text);
return $text;
}
$newsitems = array();
$one = "1";
$newsdisplay = "10";
while ($row = mysql_fetch_array($result)) {
if ($one <= $newsdisplay) {
$current_topic = $row['topic_id'];
$current_post_id = $row['post_id'];
$current_subject = $row['post_subject'];
$useridquery = "SELECT * FROM " . $table_prefix . "users WHERE user_id='" . $row['poster_id'] . "';";
$useridresults = mysql_query($useridquery);
$useridrow = mysql_fetch_object($useridresults);
if (in_array($current_topic, $newsitems)) {
echo "";
echo "";
} else {
array_push($newsitems, $row['topic_id']);
$message = str_replace("\n", '<br />', replace_bb_code($row['post_text']));
$message = str_replace("[size=", "<font size=\"", $message);
$message = str_replace("[url=", "<a href=\"", $message);
$message = str_replace("[/size]", "</font>", $message);
$message = str_replace("[/url]", "</a>", $message);
$message = str_replace("[marquee]", "<marquee>", $message);
$message = str_replace("[/marquee]", "</marquee>", $message);
$message = str_replace("]", "\">", $message);
$message = str_replace("0\">", "0]", $message);
$message = str_replace("1\">", "1]", $message);
$message = str_replace("jpg\">", "jpg\" alt=\"\" />", $message);
if($charlimit > 0) {
if(strlen($message) > $charlimit) {
$message = substr($message,0,$charlimit) . "...<a href=\"/" . $forumpath . "/viewtopic.php?f=1&t=" . $current_topic . "\">(read more)</a>";
echo "";
}
}
else {
$message = $message;
echo "";
}
$posterlink = '<a href="/'.$forumpath.'/memberlist.php?mode=viewprofile&u='.$row['poster_id'].'\">'.$useridrow->username.'</a>';
$postdate = date('d\. m\. Y', $row['post_time']);
$posttime = strftime("%H:%M", $row['post_time']);
if ($row = mysql_fetch_row($result1))
{
$topic = $row['topic_replies'];
}
$result1 = mysql_query("SELECT topic_replies FROM `phpbb_topics` WHERE topic_id = '" . $current_topic . "'");
$viewlink = "<a href=\"/" . $forumpath . "/viewtopic.php?f=1&t=" . $current_topic . "\">Kommentare</a> (" . $result1 . ")";
$avatar = '<img src="/'.$forumpath.'/download/file.php?avatar='.$useridrow->user_avatar.'" alt="" width="50px" height="50px"/>';
if(file_exists("template.html")) {
$template = file_get_contents("template.html");
$template = str_replace("{subject}", $current_subject, $template);
$template = str_replace("{posterlink}", $posterlink, $template);
$template = str_replace("{postdate}", $postdate, $template);
$template = str_replace("{posttime}", $posttime, $template);
$template = str_replace("{message}", $message, $template);
$template = str_replace("{viewlink}", $viewlink, $template);
if($showavatars) {
$template = str_replace("{avatar}", $avatar, $template);
echo "";
}
else {
$template = str_replace("{avatar}", "", $template);
echo "";
}
echo $template;
}
else {
echo "Template file not found! Stopping Execution of the rest of the page :(";
exit();
}
$one++;
}
}
}
?>
Code: Alles auswählen
<link rel="stylesheet" type="text/css" href="../font.css">
<link rel="stylesheet" type="text/css" href="style.css">
<h4>
<table width=100%>
<tr>
<td width="51px">
{avatar}
</td>
<td>
<h4 id="line">{subject}</h4>
<h3>Erstellt von {posterlink} am {postdate}, um {posttime} Uhr.</h3>
</td>
</tr>
<tr>
<td colspan="3"><h1>{message}</h1></td>
</tr>
<tr>
<td align="right" colspan="2"><h4>{viewlink}</h4></td>
</tr>
</table>
</h4>
Code: Alles auswählen
if ($row = mysql_fetch_row($result1))
{
$topic = $row['topic_replies'];
}
$result1 = mysql_query("SELECT topic_replies FROM `phpbb_topics` WHERE topic_id = '" . $current_topic . "'");
$viewlink = "<a href=\"/" . $forumpath . "/viewtopic.php?f=1&t=" . $current_topic . "\">Kommentare</a> (" . $result1 . ")";
Jedoch kommt immer folgende Ausgabe:
Notice: Undefined variable: result1 in /usr/export/www/vhosts/funnetwork/hosting/nightkiller87/hgl/news.php on line 127
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /usr/export/www/vhosts/funnetwork/hosting/nightkiller87/hgl/news.php on line 127
PATCH 1.2
Erstellt von Nightkiller am 13. 02. 2008, um 14:11 Uhr.
Dieser PATCH wird doch nicht komplett nur den Marksman (Scharfschützen) betreffen.
Die Balance in den Alptraum Modis soll auch noch verbessert werden, vor allem im 5. Akt.
Changelog:
There have been many requests and polls asking the playerbase what they wanted fixed/added next. Was a "Marksman Rework" even close to the top request?
Or was it bugs, a way to transfer items between toons, and fixing act 5 NM?
Patch 1.2 addresses a very wide range of desires and issues. The patch notes published here do not represent everything this update has to offer. One new fix released today is that Act 5 Nightmare will be addressed in Patch 1.2.
Kommentare (Resource id #11)
Notice: Undefined index: topic_replies in /usr/export/www/vhosts/funnetwork/hosting/nightkiller87/hgl/news.php on line 129