Eerste probleem is ondertussen verholpen. Nu krijg ik volgend probleem. Ik heb 2 gesloten Sticky Topics. Nu toond hij er jammer genoeg maar 1. Toch gebruik ik de code om te vragen om 2 of meer lijnen te maken! Op andere pagina's werkt die code perfect, behalve hier! Dit is de volledige code!

<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<?
// Checken op errors
ini_set('display_errors', 1); // 0 = uit, 1 = aan
error_reporting(E_ALL);

// Set variable sticky
$resultOK = 1;

// Verbinden met Database
$sql="SELECT * FROM vraag WHERE Sticky='".$resultOK."' ORDER BY id DESC";
$result=mysql_query($sql)or die(mysql_error());
$checkROWS=mysql_num_rows($result);
$checkLOCK=mysql_fetch_array($result);

$Locked=$checkLOCK['Locked'];

// Check rows is 1 & locked is 0
if ($checkROWS == 1 && $Locked == 0)
 { 
?>
<tr>
<td width="6%"><center><img src="../../../images/icons/error.png" alt="STICKY" width="16" height="16"></center></td>
<td width="53%"><a href="topic.php?id=<? echo $checkLOCK['id']; ?>"><font color="black"><? echo $checkLOCK['topic']; ?></font></a></a></td>
<td width="13%"><font color="black"><? echo $checkLOCK['datumtijd']; ?></font></td>
</tr>

<?
 }
// Check rows is 1 & locked is 1
elseif ($checkROWS == 1 && $Locked == 1)
 {
?>
<tr>
<td width="6%"><center><img src="../../../images/icons/exclamation.png" alt="STICKY CLOSED" width="16" height="16"></center></td>
<td width="53%"><a href="topic.php?id=<? echo $checkLOCK['id']; ?>"><font color="black"><? echo $checkLOCK['topic']; ?></font></a></td>
<td width="13%"><font color="black"><? echo $checkLOCK['datumtijd']; ?></font></td>
</tr>
<?
 }
// Check rows bigger than 1 & locked is 0
elseif ($checkROWS > 1 && $Locked == 0)
 {
  while($checkLOCK=mysql_fetch_array($result))
   {
?>
<tr>
<td width="6%"><center><img src="../../../images/icons/error.png" alt="STICKY" width="16" height="16"></center></td>
<td width="53%"><a href="topic.php?id=<? echo $checkLOCK['id']; ?>"><font color="black"><? echo $checkLOCK['topic']; ?></font></a></td>
<td width="13%"><font color="black"><? echo $checkLOCK['datumtijd']; ?></font></td>
</tr>
<?
   }
 }
// Check rows bigger than 1 & locked is 1
elseif ($checkROWS > 1 && $Locked == 1)
 {
  while($checkLOCK=mysql_fetch_array($result))
   {
?>
<tr>
<td width="6%"><center><img src="../../../images/icons/exclamation.png" alt="STICKY CLOSED" width="16" height="16"></center></td>
<td width="53%"><a href="topic.php?id=<? echo $checkLOCK['id']; ?>"><font color="black"><? echo $checkLOCK['topic']; ?></font></a></td>
<td width="13%"><font color="black"><? echo $checkLOCK['datumtijd']; ?></font></td>
</tr>
<?
   }
 }
// None of them, use this
else
 {
?>
<tr>
<td width="6%" height="0"></td>
<td width="53%" height="0"></td>
<td width="13%" height="0"></td>
</tr>
<?
 }
?>
<tr>
<td width="6%" height="5">&nbsp;</td>
<td width="53%" height="5">&nbsp;</td>
<td width="13%" height="5">&nbsp;</td>
</tr>
</table>
In principe zetten we dit altijd in een while:

$checkLOCK=mysql_fetch_array($result);

Dus:

<?
while($checkLOCK=mysql_fetch_array($result)){
// hier wat er moet gebeuren, voor elke rij uit je database
}
?>

Als dit het niet is, snap ik denk ik je vraag niet.
Allright. Daar zat het dus fout. Thx :)

Reageren