RE: Newbie Question re substr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jackson Linux [mailto:jackson.linux@xxxxxxxxx] 
Sent: 8. marts 2005 04:23

First of all, echo the output to see if You get, what Tou expect in a debug situation:

if (!empty($where)) {

echo "
 <ul>";
  $article = mysql_fetch_assoc($result);
} else {
  while ($article = mysql_fetch_assoc($result)) {
    // humanize data
    $article_id = $article['article_id'];
    $title = $article['title'];
    $content = substr($article['content'], 0 200); // get first 200 chars 
    // print and see if we get, what we expect
    Print "id=$article_id<br>title=$title<br>content=$content<p>";
    // now make the real stuff
    print "<li><a href='{" . $_SERVER['PHP_SELF'] . "}?a={$article_id}'}&title='{$title}'>{$article['title']}</a><br />\n$content</li>";
  }
}

echo "
 </ul>";

I´ve put the "&" in front of title since the link otherwise would be <a href="a=1234title=sometext">, which is not what You want I guess.

And I substituted the 

  $article['content'] = substr($article['content'], 0 200);</li>"; } }

with

  $content</li>";

since I believe You want to print the content and not just assign it? Otherwise the <br /> makes no sense :-)

> Can anyone help ?

I hop that did the trick for You :-)

-- 
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen 
Systemudvikler
Naverland 31

DK-2600 Glostrup
www.comx.dk 
Telefon: +45 70 25 74 74
Telefax: +45 70 25 73 74
E-mail: km@xxxxxxx

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux