Hallo allemaal ik heb een kleine bugje op mijn forum.
Sinds het de eerste is van deze nieuwe maand komen mijn forum berichten niet meer onderaan testaan maar boven aan, erg vervelend ik kan er zelf niet meer uit wellicht is er hier iemand die dit even voor mij kan doen voor een bedrag van 45 euro.

Stuur me dan even een PB.

Met vriendelijke groeten,
Bob
Hoe lang draait het forum al?
Is het een zelf gemaakt forum of een kant en klare (welke/waar vandaan)?

Inkopper: lijkt er op dat er met de sortering iets niet goed gaat.
Plaats eventueel wat code (tussen code-tags), zodat er naar gekeken kan worden.

Hier de code, is redelijk vieze code ben bezig momenteel een nieuw forum te bouwen, maarja daar ben ik nog niet mee klaar en heb nu een tijdelijke oplossing nodig voor mijn gebruikers, en ben daarom bereid te betalen,

De code:

<?php

    if(isset($_GET['x'])){
        $_GET['x'] = mysql_real_escape_string($_GET['x']);
    }
    
    if(isset($_GET['p'])){
        $_GET['p'] = mysql_real_escape_string($_GET['p']);
    }
    
    if(isset($_GET['id'])){
        $_GET['id'] = mysql_real_escape_string($_GET['id']);
    }

	$dbresb		=	mysql_query("SELECT forum_id, id, login, titel, message, DATE_FORMAT(time,'%d/%m/%Y %H:%i') as time FROM `topic` WHERE `id`='{$_GET['x']}'");
	$topic		=	mysql_fetch_object($dbresb);
	$message	=	ubb($topic->message);
	$dbresc		=	mysql_query("SELECT * FROM `gebruiker` WHERE `login`='{$topic->login}'");
	$login1		=	mysql_fetch_object($dbresc);
	$dbresd		=	mysql_query("SELECT * FROM `gebruiker` WHERE UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(`online`) < 300 AND `login`='{$login1->login}'");
	$controlle	=	mysql_num_rows($dbresd);
		
		if($login1->avater == ""){
		$avater		=	"/images/avater.jpg";
		} else {
		$avater		=	$login1->avater;
		}
	
		if($controlle == 1){
		$status	=	"Online";
		} else {
		$status	=	"Offline";
		}
	
		if($_GET['actie'] == "delete"){
		$dbres	=	mysql_query("SELECT login, topic_id FROM `topic_replay` WHERE `id`='{$_GET['id']}'");
			if($topic = mysql_fetch_object($dbres)){
				if($topic->login == $data->login || $data->level == 3){
				mysql_query("UPDATE `topic` SET `replays`=`replays`-'1' WHERE `id`='{$topic->topic_id}'");
				mysql_query("DELETE FROM `topic_replay` WHERE `id`='{$_GET['id']}'");
                
                $sql = mysql_query("SELECT forum_id FROM topic WHERE id = '".$topic->topic_id."'");
                
                $or_topic = mysql_fetch_object($sql);
                
                echo 'Reply verwijderd.<br />
                        <a href="forum-topic.php?x='.$topic->topic_id.'" style="text-decoration: none;" class="whitetext">Ga terug naar het topic</a>';
				//echo "<meta http-equiv=\"refresh\" content=\"0\" URL=\"http://http://www.zweinsteinonline.nl/ingame/forum-topic.php?x={$topic->topic_id}\">";
				//exit;
				}
			}
		}
    if(!isset($_GET['actie'])){
	?>
	
	<table class="view-topic">
		<tr class="topic-title">
			<td colspan="2">
			<strong>&nbsp;<?php echo $topic->titel; ?></strong>
			</td>
		</tr>
		<tr>
			<td class="subtitle" colspan="2" style="padding:0; spacing:0;">
			<table class="info-box-table">
				<tr class="info-box">
					<td align="right" width="20">
					<img src="/images/user.png" width="18" height="16" border="0">
					</td>
					<td width="240" align="left">
					<a href="speler-profiel.php?x=<?php echo $login1->login; ?>" style='text-decoration: none;' class='whitetext'><strong><?php echo $login1->login; ?></strong></a>
					(<?php echo $login1->posts; ?> posts)
					</td>
					<td align="left" width="115">
					<?php echo $topic->time; ?>
					</td>
				</tr>
			</table>
			</td>
		</tr>
		<tr>
			<td class="maintxt" align="center" valign="top" width="120">
			<a href="speler-profiel.php?x=<?php echo $login1->login; ?>" style='text-decoration: none;' class='whitetext'><img src="<?php echo $avater; ?>" width="100" height="100" border="0"></a>
			<br />
			</td>
			<td class="maintxt" align="left" valign="top" width="480">
			<?php echo $message; ?>
			</td>
		</tr>
	
	
	<?php
	
	$begin		=	($_GET['p'] >= 0) ? $_GET['p']*9 : 0;
	$dbresa		=	mysql_query("SELECT id, login, message, DATE_FORMAT(time,'%d/%m/%Y %H:%i') as time FROM `topic_replay` WHERE `topic_id`='{$_GET['x']}' ORDER BY `time` LIMIT $begin,9");
	
	$check_exist = mysql_num_rows(mysql_query("SELECT * FROM active_topics WHERE usrid = '".$_SESSION['uid']."' AND topid = '".$topic->id."'"));
	
	if($check_exist >0){
		
	} else {
		
	$result = mysql_query("INSERT INTO active_topics (usrid,topid,frmid,date) VALUES ('".$_SESSION['uid']."','".$topic->id."','".$topic->forum_id."',now())")or die(mysql_error());
	
	}
	
	?>
	
	
	
	<?php
	
		while($replay = mysql_fetch_object($dbresa)){
		$dbres1		=	mysql_query("SELECT `login`,`posts`,`avater`,UNIX_TIMESTAMP(`online`) AS `online`,0 FROM `gebruiker` WHERE `login`='{$replay->login}'");
		$login1		=	mysql_fetch_object($dbres1);
		$message	=	ubb($replay->message);
	
			if($login1->online + 300 > time()){
			$status	=	"Online";
			} else {
			$status	=	"Offline";
			}
	
		if($login1->avater == ""){
		$avater		=	"/images/avater.jpg";
		} else {
		$avater		=	$login1->avater;
		}
	

	?>
	
		<tr>
			<td class="subtitle" width="275" colspan="2" style="padding:0; spacing:0;">
			<table class="info-box-table">
				<tr class="info-box">
					<td align="right" width="20">
					<img src="/images/user.png" width="18" height="16" border="0">
					</td>
					<td width="200" align="left">
					<a href="speler-profiel.php?x=<?php echo $login1->login; ?>" style='text-decoration: none;' class='whitetext'><strong><?php echo $login1->login; ?></strong></a>
					(<?php echo $login1->posts; ?> posts)
					</td><td width="40"><?php if($data->level == 3){ ?><a href="forum-topic.php?actie=delete&id=<?php echo $replay->id; ?>" style='text-decoration: none;' class='whitetext'><img src="/images/delete.png" border=0 width="16" height="16" /></a><?php }  if($data->level == 3 || ($_SESSION['login'] == $login1->login)){ ?><a href="forum-newtopic.php?actie=edit&type=reply&id=<?php echo $replay->id; ?>" style='text-decoration: none;' class='whitetext'><img src="/images/edit.png" border=0 width="16" height="16" /></a><?php } ?></td>
				
					<td width="115">
					<?php echo $replay->time; ?>
					</td>
				</tr>
			</table>
			</td>
		</tr>
		<tr>
			<td valign="top" width="120">
			<a href="speler-profiel.php?x=<?php echo $login1->login; ?>" style='text-decoration: none;' class='whitetext'><img src="<?php echo $avater; ?>" width="100" height="100" border="0"></a>
			<br /><b></b>
			</td>
			<td class="maintxt" valign="top" width="275">
			<?php echo $message; ?>
			</td>
		</tr>
	
	<?php
	
		}
	
	?>
	
	</table>
	<table align="center" width="275">
	
	<?php
	
	$dbres		=	mysql_query("SELECT * FROM `topic_replay` WHERE `topic_id`='{$_GET['x']}'");
	
		if(mysql_num_rows($dbres) > 9){
		echo "<tr><td class=\"maintxt\" align=\"center\" colspan=\"4\">";
	
			if($begina/9 == 0){
			echo "<<</font>";
			} else {
			echo "<a href=\"forum-topic.php?id={$_GET['id']}&x={$_GET['x']}&p=". ($begina/9-1) ."\" style='text-decoration: none;' class='whitetext'><<</a>";
			}
	
			for($i=0; $i<mysql_num_rows($dbres)/9; $i++){
			echo " <a href=\"forum-topic.php?id={$_GET['id']}&x={$_GET['x']}&p=$i\" style='text-decoration: none;' class='whitetext'>". ($i+1) ."</a> ";
			}
	
			if($begina+9 >= mysql_num_rows($dbres)) {
			echo ">>";
			} else {
			echo "<a href=\"forum-topic.php?id={$_GET['id']}&x={$_GET['x']}&p=". ($begina/9+1) ."\" style='text-decoration: none;' class='whitetext'>>></a>";
			}
	
		echo "&nbsp; </td></tr><tr>";
		}
	
	?>
	
	</table>
    
    <?php
    }
    ?>
	<table width="275">
		<tr>
			<td colspan="2"></td>
		</tr>
		<tr>
			<td colspan="2" align="center"></td>
		</tr>
	
	<?php
	
		if($data->level == 3 OR $topic->soort != 2){
	
	?>
	
		<tr>
			<td width="300" ><table><tr><td><img src="/images/new_topic.png" /></td><td><a href="forum-newtopic.php?z=<?php echo $topic->id; ?>" style='text-decoration: none;' class='whitetext'><strong>Reageren</strong></a></td></tr></table></td><td class="maintxt" width="300" align="center"><table><tr><td><img src="/images/forum.png" /></td><td><a href="forum-board.php?x=<?php echo $topic->forum_id; ?>" style='text-decoration: none;' class='whitetext'><strong>Terug naar forum</strong></a></td></tr></table></td>
		</tr>
		<tr>
			<td colspan="2">&nbsp;</td>
		</tr>
	</table>
	
	<?php
	
		} else {
	
	?>
Klopt excuus heb ik hier een typ fout gemaakt, heb me post ge-edit.
Wat is de URL naar de site? Dan kunnen we kijken hoe het er uitziet..
Wat voor datatype heeft de kolom time?
Ik vermoed dat dit werkt:
<?php
//regel 94
$dbresa = mysql_query("SELECT id, login, message, DATE_FORMAT(time,'%d/%m/%Y %H:%i') as format_time FROM `topic_replay` WHERE `topic_id`='{$_GET['x']}' ORDER BY `time` LIMIT $begin,9");
?>
Je moet dan in je code wel format_time gebruiken i.p.v. time (je maakt er nu eerst een datum van waarop gesorteerd wordt. Hierdoor sorteert die als eerste op dag, dan op maand etc.

Als dit de oplossing is mag je die €45 overmaken naar World Servants ( http://www.worldservants.nl/inhoud.php?id=31 ) (Goed doel dus is het nog aftrekbaar als gift)
Deze kolom heeft datetime type.
En die oplossing die ik geef, werkt die?
Is me niet gelukt met jou code krijg enkeld geen foutmelding maar hij sorteerd nog niet goed?
Dat je geen foutmelding krijgt komt omdat je die niet weergeeft anders zou je bij de eerste regels al een melding krijgen.

Zet dit eens bovenaan je code
<?php
error_reporting(E_ALL);
ini_set('display_errors',1);
?>

Kun je me anders even een url pmen?

Reageren