08. februar 2005 - 16:26
Der er
5 kommentarer og 1 løsning
Vise seneste 4 nyhedsoverskrifter
Jeg har på min side sat dette ind for at vise de seneste 4 overskrifter: <? include("dbconnect.php"); $getnews = mysql_query("select * from news ORDER BY id DESC LIMIT 4"); while($r=mysql_fetch_array($getnews)){ extract($r); echo ' '; echo ("$title"); echo '<br>'; } ?> Problemet er så at jeg gerne ville have dette sat ind i php'en: <tr> <td height="20" class="leftside" bgcolor="#DDDDDD" onMouseover='this.style.backgroundColor="#CACACA"' onMouseOut='this.style.backgroundColor="#DDDDDD"'>$title</td> </tr> så den i stedet for bare at skrive overskriften og skifte linje, altså sætter en ny td ind med bestemt højde, og jscript og ting. Dette kan jeg bare ikke få til at fungere. På forhånd tak.
Annonceindlæg fra IFS Danmark A/S
08. februar 2005 - 16:30
#1
<? include("dbconnect.php"); $getnews = mysql_query("select * from news ORDER BY id DESC LIMIT 4"); while($r=mysql_fetch_array($getnews)){ extract($r); echo ' '; echo ("<tr><td height="'0' class='leftside' bgcolor='#DDDDDD' onMouseover='this.style.backgroundColor=#CACACA' onMouseOut='this.style.backgroundColor=#DDDDDD'>"); echo ("$title"); echo ("</td></tr>"); echo '<br>'; } ?>
08. februar 2005 - 16:30
#2
Prøv med: "select Top 4 from..." og erstat echo ("$title"); med echo "<td height=\"20\" class=\"leftside\" bgcolor=\"#DDDDDD\" onMouseover='this.style.backgroundColor=\"#CACACA\"' onMouseOut='this.style.backgroundColor=\"#DDDDDD\"'>$title</td>" Læg mærke til at alle " tegn er erstattet af \"
08. februar 2005 - 16:30
#3
Rettelse: - - - <? include("dbconnect.php"); $getnews = mysql_query("select * from news ORDER BY id DESC LIMIT 4"); while($r=mysql_fetch_array($getnews)){ extract($r); echo ' '; echo ("<tr><td height='0' class='leftside' bgcolor='#DDDDDD' onMouseover='this.style.backgroundColor=#CACACA' onMouseOut='this.style.backgroundColor=#DDDDDD'>"); echo ("$title"); echo ("</td></tr>"); echo '<br>'; } ?> - - -