PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hey all... I'm pulling some code out of a mysql DB and trying to highlight it. Not workin, heh...
I put it in the DB with htmlspecialchars and I can pull it out and echo it just fine. However, I must be using highlight_string the wrong way because it won't show the colors.
$sql = "SELECT title, author, body, hits, rating FROM code LIMIT 0,5";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)){
//$code = nl2br($row['body']); //you don't want this... but if you want to see a bunch of <br /> tags, than gofor it!
highlight_string($code);
}
Last edited by Illusionist on Sun May 23, 2004 5:34 pm, edited 2 times in total.