View Single Post
Old 08-04-2008, 03:18 PM   #1 (permalink)
Evulness
The Contributor
 
Evulness's Avatar
 
Join Date: Apr 2008
Location: Tampa, FL
Posts: 65
Thanks: 6
Evulness is on a distinguished road
Default pregreplace & minor bbcoding

Ok, heres my deal.

Code:
echo '<tr align="center">';
foreach ($row as $key => $value) {
    if ($key == "id"){
    echo '<td bgcolor="'.$bg.'" ><a href="index.php?page=edit&id='.$value.'">'.$value.'</a></td>';
    }else{
        if ($key == "comment"){
            echo '<td bgcolor="'.$bg.'" width="25%" >'.$value.'</td>';}
                     else{echo '<td bgcolor="'.$bg.'" >'.$value.'</td>';
         }
    }
  }
    echo "</tr>";
query for above code
Quote:
sql ="SELECT id, username, email, first_name, last_name, nonprofit_date, packet1, packet2, comment
FROM users
WHERE level=1
ORDER by ".$order." ".$dir."
LIMIT ".$limit."
";
when i do this, my comment cell is a bunch of comments. each seperate comment is surrounded like bbcode [my comment1] [mycomment2]

what i need to do is take this part:
Code:
if ($key == "comment"){
            echo '<td bgcolor="'.$bg.'" width="25%" >'.$value.'</td>';}
                     else{echo '<td bgcolor="'.$bg.'" >'.$value.'</td>';
         }
and i need to parse out that indevidual if() statement, and make it parts out each [] and put it on a seperate line. i know i need to use a preg_replace. but preg_replace is so forigne to me... i can't figure out how to get it to work.

any suggestions?
__________________
"Knowledge is power. Abuse it."~Evulness
My portfolio: www.evularts.com
Send a message via AIM to Evulness
Evulness is offline  
Reply With Quote