21. april 2008 - 19:21Der er
32 kommentarer og 1 løsning
Forkort tekst fra database
hej hvordan for jeg dette til at virke, så "synopsis" kun kommer frem med 50 tegn..
<?php
include('news/inc.config.php'); $query = mysql_query("SELECT id,title,author,synopsis,text,image,date FROM newsloge ORDER BY id DESC LIMIT 7") or die(mysql_error()); while ($row = mysql_fetch_assoc($query)) { if ($i++ != 0) echo '<div class="hr"></div>';
include('news/inc.config.php'); $query = mysql_query("SELECT id,title,author,synopsis,text,image,date FROM newsloge ORDER BY id DESC LIMIT 7") or die(mysql_error()); while ($row = mysql_fetch_assoc($query)) { if ($i++ != 0) echo '<div class="hr"></div>';
arbejdede jo kun med variablen $synopsis, som ikke så ud til at indeholde noget. Og så udskrev du $row['synopsis'] i fuld længde lige neden under. Så det skulle være rettet i min kode.
"LOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOL, det er bare zuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuper fedt!!!"
og lign. :P Så falder det vel lidt til jorden, eller hvad?
I øvrigt kan du opnå "..."-effekten med:
<?php
include('news/inc.config.php'); $query = mysql_query("SELECT id,title,author,synopsis,text,image,date FROM newsloge ORDER BY id DESC LIMIT 7") or die(mysql_error()); while ($row = mysql_fetch_assoc($query)) { if ($i++ != 0) echo '<div class="hr"></div>';
det er kun mig der skriver i news så den med "LOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOL, det er bare zuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuper fedt!!!" bliver nok ikke aktuelt *SS*
include('news/inc.config.php'); $query = mysql_query("SELECT id,title,author,synopsis,text,image,date FROM newsloge ORDER BY id DESC LIMIT 7") or die(mysql_error()); while ($row = mysql_fetch_assoc($query)) { if ($i++ != 0) echo '<div class="hr"></div>';
include('news/inc.config.php'); $query = mysql_query("SELECT id,title,author,synopsis,text,image,date FROM newsloge ORDER BY id DESC LIMIT 7") or die(mysql_error()); while ($row = mysql_fetch_assoc($query)) { if ($i++ != 0) echo '<div class="hr"></div>';
Hvid skærm ligefrem? Det giver da ingen mening. Prøv lige med:
<?php
include('news/inc.config.php'); $query = mysql_query("SELECT id,title,author,synopsis,text,image,date FROM newsloge ORDER BY id DESC LIMIT 7") or die(mysql_error()); while ($row = mysql_fetch_assoc($query)) { if ($i++ != 0) echo '<div class="hr"></div>';
include('news/inc.config.php'); $query = mysql_query("SELECT id,title,author,synopsis,text,image,date FROM newsloge ORDER BY id DESC LIMIT 7") or die(mysql_error()); while ($row = mysql_fetch_assoc($query)) { if ($i++ != 0) echo '<div class="hr"></div>';
der er noget jeg ikke forstår ved dette eksempel er det kun titel der kommer frem
<?php
include('news/inc.config.php'); $query = mysql_query("SELECT id,title,author,synopsis,text,image,date FROM newsloge ORDER BY id DESC LIMIT 7") or die(mysql_error()); while ($row = mysql_fetch_assoc($query)) { if ($i++ != 0) echo '<div class="hr"></div>';
include('news/inc.config.php'); $query = mysql_query("SELECT id,title,author,synopsis,text,image,date FROM newsloge ORDER BY id DESC LIMIT 7") or die(mysql_error()); while ($row = mysql_fetch_assoc($query)) { if ($i++ != 0) echo '<div class="hr"></div>';
include('news/inc.config.php'); $query = mysql_query("SELECT id,title,author,synopsis,text,image,date FROM newsloge ORDER BY id DESC LIMIT 7") or die(mysql_error()); while ($row = mysql_fetch_assoc($query)) { if ($i++ != 0) echo '<div class="hr"></div>';
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.