Avatar billede aquafisken Nybegynder
24. december 2005 - 02:16 Der er 1 løsning

Problemer med udskrivning fra MySQL database

Jeg har et problem med at få nogle data skrevet ud fra en database.
Det handler om at jeg har en unit_section og unit_race, som er det der skal være med til at opdele indholdet fra databasen på siden, koden er denne:

<td>
<!--WHLords Start -->
<div class="overskrift">DWARFS</div>
<br />
<div class="overskriftminuscenter">LORDS</div>
<table width="100%" border="0" cellpadding="0" cellspacing="5">
<?
@include "../admin/connect.php";

include "../admin/bbcode.php";

$query = mysql_query("SELECT * FROM army WHERE unit_race='WHBDwarfs' AND unit_section='WHLords'") or die("Der er sket en fejl. Fejlnr. ".mysql_errno());
while ($row = mysql_fetch_array($query)) {

$unit_navnWHLords         = stripslashes($row[unit_navn]);
$unit_textWHLords          = stripslashes($row[unit_text]);
$unit_positivWHLords     = stripslashes($row[unit_positiv]);
$unit_negativWHLords      = stripslashes($row[unit_negativ]);
$newtext                 = nl2br($newtext);
$thumbnailWHLords        = $row["thumbnail"];
$originalpicWHLords        = $row["originalpic"];
$dato                    = $row["dato"];
?>
<tr align="left" valign="middle">
<td colspan="2"><font class="dato"><?php echo "$dato" ?></font><br /><font class="unithead"><?php $htmlunit_navnWHLords = bbcode($unit_navnWHLords); echo "$htmlunit_navnWHLords" ?></font></td>
</tr>
<tr>
<td width="130" rowspan="3" align="left" valign="top"><a href="../admin/addunit/images/<?php echo "$originalpicWHLords" ?>" target="_blank"><img src="../admin/addunit/images/<?php echo "$thumbnailWHLords" ?>" border="0"></a><br />
  <a href="../admin/addunit/images/<?php echo "$originalpicWHLords" ?>" target="_blank"><img src="http://www.barricade.dk/Images/pushpic.gif" width="41" height="9" border="0"/></a></td>
<td width="605"><font class="text"><?php $htmlunit_textWHLords = bbcode($unit_textWHLords); echo "$htmlunit_textWHLords" ?></font></td>
</tr>
<tr>
<td><font class="text"><?php $htmlunit_positivWHLords = bbcode($unit_positivWHLords); echo "$htmlunit_positivWHLords" ?></font></td>
</tr>
<tr>
<td><font class="text"><?php $htmlunit_negativWHLords = bbcode($unit_negativWHLords); echo "$htmlunit_negativWHLords" ?></font></td>
</tr>
<tr>
<?php
}
?>
<tr>
<td>
<!--WHLords Slut -->
<!--WHHeroes Start -->
<br />
<div class="overskriftminuscenter">HEROES</div>
</td>
</tr>
<?
@include "../admin/connect.php";

include "../admin/bbcode.php";

$query = mysql_query("SELECT * FROM army WHERE unit_race='WHBDwarfs' AND unit_section = 'WHHeroes'") or die("Der er sket en fejl. Fejlnr. ".mysql_errno());
while ($row = mysql_fetch_array($query)) {

$unit_navnWHHeroes         = stripslashes($row[unit_navn]);
$unit_textWHHeroes      = stripslashes($row[unit_text]);
$unit_positivWHHeroes     = stripslashes($row[unit_positiv]);
$unit_negativWHHeroes      = stripslashes($row[unit_negativ]);
$newtext                 = nl2br($newtext);
$thumbnailWHHeroes        = $row["thumbnail"];
$originalpicWHHeroes    = $row["originalpic"];
$dato                    = $row["dato"];
?>
<tr align="left" valign="middle">
<td colspan="2"><font class="dato"><?php echo "$dato" ?></font><br /><font class="unithead"><?php $htmlunit_navnWHHeroes = bbcode($unit_navnWHHeroes); echo "$htmlunit_navnWHHeroes" ?></font></td>
</tr>
<tr>
<td width="130" rowspan="3" align="left" valign="top"><a href="../admin/addunit/images/<?php echo "$originalpicWHHeroes" ?>" target="_blank"><img src="../admin/addunit/images/<?php echo "$thumbnailWHHeroes" ?>" border="0"></a><br />
  <a href="../admin/addunit/images/<?php echo "$originalpicWHHeroes" ?>" target="_blank"><img src="http://www.barricade.dk/Images/pushpic.gif" width="41" height="9" border="0"/></a></td>
<td width="605"><font class="text"><?php $htmlunit_textWHHeroes = bbcode($unit_textWHHeroes); echo "$htmlunit_textWHHeroes" ?></font></td>
</tr>
<tr>
<td><font class="text"><?php $htmlunit_positivWHHeroes = bbcode($unit_positivWHHeroes); echo "$htmlunit_positivWHHeroes" ?></font></td>
</tr>
<tr>
<td><font class="text"><?php $htmlunit_negativWHHeroes = bbcode($unit_negativWHHeroes); echo "$htmlunit_negativWHHeroes" ?></font></td>
</tr>
<tr>
<?php
}
?>
<tr>
<td>
<!--WHHeroes Slut -->
<!--WHCore Start -->
<br />
<div class="overskriftminuscenter">CORE UNIT</div>
</td>
</tr>
<?
@include "../admin/connect.php";

include "../admin/bbcode.php";

$query = mysql_query("SELECT * FROM army WHERE unit_race='WHBDwarfs' AND unit_section='WHCore'") or die("Der er sket en fejl. Fejlnr. ".mysql_errno());
while ($row = mysql_fetch_array($query)) {

$unit_navnWHCore         = stripslashes($row[unit_navn]);
$unit_textWHCore          = stripslashes($row[unit_text]);
$unit_positivWHCore     = stripslashes($row[unit_positiv]);
$unit_negativWHCore      = stripslashes($row[unit_negativ]);
$newtext                 = nl2br($newtext);
$thumbnailWHCore        = $row["thumbnail"];
$originalpicWHCore        = $row["originalpic"];
$dato                    = $row["dato"];
?>
<tr align="left" valign="middle">
<td colspan="2"><font class="dato"><?php echo "$dato" ?></font><br /><font class="unithead"><?php $htmlunit_navnWHCore = bbcode($unit_navnWHCore); echo "$htmlunit_navnWHCore" ?></font></td>
</tr>
<tr>
<td width="130" rowspan="3" align="left" valign="top"><a href="../admin/addunit/images/<?php echo "$originalpicWHCore" ?>" target="_blank"><img src="../admin/addunit/images/<?php echo "$thumbnailWHCore" ?>" border="0"></a><br />
  <a href="../admin/addunit/images/<?php echo "$originalpicWHCore" ?>" target="_blank"><img src="http://www.barricade.dk/Images/pushpic.gif" width="41" height="9" border="0"/></a></td>
<td width="605"><font class="text"><?php $htmlunit_textWHCore = bbcode($unit_textWHCore); echo "$htmlunit_textWHCore" ?></font></td>
</tr>
<tr>
<td><font class="text"><?php $htmlunit_positivWHCore = bbcode($unit_positivWHCore); echo "$htmlunit_positivWHCore" ?></font></td>
</tr>
<tr>
<td><font class="text"><?php $htmlunit_negativWHCore = bbcode($unit_negativWHCore); echo "$htmlunit_negativWHCore" ?></font></td>
</tr>
<tr>
<?php
}
?>
<tr>
<td>
<!--WHCore Slut -->
<!--WHSpecial Start -->
<br />
<div class="overskriftminuscenter">SPECIAL FORCE </div>
</td>
</tr>
<?
@include "../admin/connect.php";

include "../admin/bbcode.php";

$query = mysql_query("SELECT * FROM army WHERE unit_race='WHBDwarfs' AND unit_section='WHSpecial'") or die("Der er sket en fejl. Fejlnr. ".mysql_errno());
while ($row = mysql_fetch_array($query)) {

$unit_navnWHSpecial     = stripslashes($row[unit_navn]);
$unit_textWHSpecial          = stripslashes($row[unit_text]);
$unit_positivWHSpecial     = stripslashes($row[unit_positiv]);
$unit_negativWHSpecial     = stripslashes($row[unit_negativ]);
$newtext                 = nl2br($newtext);
$thumbnailWHSpecial        = $row["thumbnail"];
$originalpicWHSpecial    = $row["originalpic"];
$dato                    = $row["dato"];
?>
<tr align="left" valign="middle">
<td colspan="2"><font class="dato"><?php echo "$dato" ?></font><br /><font class="unithead"><?php $htmlunit_navnWHSpecial = bbcode($unit_navnWHSpecial); echo "$htmlunit_navnWHSpecial" ?></font></td>
</tr>
<tr>
<td width="130" rowspan="3" align="left" valign="top"><a href="../admin/addunit/images/<?php echo "$originalpicWHSpecial" ?>" target="_blank"><img src="../admin/addunit/images/<?php echo "$thumbnailWHSpecial" ?>" border="0"></a><br />
  <a href="../admin/addunit/images/<?php echo "$originalpicWHSpecial" ?>" target="_blank"><img src="http://www.barricade.dk/Images/pushpic.gif" width="41" height="9" border="0"/></a></td>
<td width="605"><font class="text"><?php $htmlunit_textWHSpecial = bbcode($unit_textWHSpecial); echo "$htmlunit_textWHSpecial" ?></font></td>
</tr>
<tr>
<td><font class="text"><?php $htmlunit_positivWHSpecial = bbcode($unit_positivWHSpecial); echo "$htmlunit_positivWHSpecial" ?></font></td>
</tr>
<tr>
<td><font class="text"><?php $htmlunit_negativWHSpecial = bbcode($unit_negativWHSpecial); echo "$htmlunit_negativWHSpecial" ?></font></td>
</tr>
<tr>
<?php
}
?>
<tr>
<td>
<!--WHSpecial Slut -->
<!--WHWHRare Start -->
<br />
<div class="overskriftminuscenter">RARE UNIT </div>
</td>
</tr>
<?
include "../admin/connect.php";

include "../admin/bbcode.php";

$query = mysql_query("SELECT * FROM army WHERE unit_race='WHBDwarfs' AND unit_section='WHRare'") or die("Der er sket en fejl. Fejlnr. ".mysql_errno());
while ($row = mysql_fetch_array($query)) {

$unit_navnWHRare         = stripslashes($row[unit_navn]);
$unit_textWHRare         = stripslashes($row[unit_text]);
$unit_positivWHRare     = stripslashes($row[unit_positiv]);
$unit_negativWHRare        = stripslashes($row[unit_negativ]);
$newtext                 = nl2br($newtext);
$thumbnailWHRare        = $row["thumbnail"];
$originalpicWHRare        = $row["originalpic"];
$dato                    = $row["dato"];
?>
<tr align="left" valign="middle">
<td colspan="2"><font class="dato"><?php echo "$dato" ?></font><br /><font class="unithead"><?php $htmlunit_navnWHRare = bbcode($unit_navnWHRare); echo "$htmlunit_navnWHRare" ?></font></td>
</tr>
<tr>
<td width="130" rowspan="3" align="left" valign="top"><a href="../admin/addunit/images/<?php echo "$originalpicWHRare" ?>" target="_blank"><img src="../admin/addunit/images/<?php echo "$thumbnailWHRare" ?>" border="0"></a><br />
  <a href="../admin/addunit/images/<?php echo "$originalpicWHRare" ?>" target="_blank"><img src="http://www.barricade.dk/Images/pushpic.gif" width="41" height="9" border="0"/></a></td>
<td width="605"><font class="text"><?php $htmlunit_textWHRare = bbcode($unit_textWHRare); echo "$htmlunit_textWHRare" ?></font></td>
</tr>
<tr>
<td><font class="text"><?php $htmlunit_positivWHRare = bbcode($unit_positivWHRare); echo "$htmlunit_positivWHRare" ?></font></td>
</tr>
<tr>
<td><font class="text"><?php $htmlunit_negativWHRare = bbcode($unit_negativWHRare); echo "$htmlunit_negativWHRare" ?></font></td>
</tr>
<tr>
<?php
}
?>
</table>
<!--WHRare Slut -->
</td>

Jeg håber der er nogen der kan finde fejlen i koden, fordi jeg har prøvet alt muligt og kan bare ikke få det til at virke...??
Avatar billede aquafisken Nybegynder
26. december 2005 - 03:01 #1
Jeg fandt ud af det.
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester