0

I have a problem... I mean it looks good, but It's erroring up...?

while($row = mysql_fetch_array($result))
{
    $fav = 0;
    $stop = 0;
    $id = $row['id'];
    $title = mysql_escape_string($row['title']);
    $body = stripcslashes(nl2br(mysql_escape_string($row['body'])));
    $time = date("n.j.Y", $row['timestamp']);

    $result1 = mysql_query("SELECT * FROM favoriteposts WHERE ip='".$_SERVER['REMOTE_ADDR']."' ORDER BY blogid DESC") or die(mysql_error()."<br><br>Please send the text above to an admin who can fix the problem!");
    while($row1 = mysql_fetch_array($result1)) {
        if($stop == 1) {
            if($id == $row1['blogid']) {
                $fav = 1;
                $stop = 1;
            } else {
                $fav = 0;   
            }
        }
    }
    echo "
    <article>
        <h1><a href='?id=".$row['id']."'>".$title."</a></h1>
        <span class='date'>".$time."</span>
        <p id='articlebody'>".$body." fav = ".$fav."<br>
        <a href='?id=".$row['id']."'>View Post</a>";
        if($fav == 1) {
            echo "<a style='margin-left:20px;' href='?fav=".$row['id']."'>Unfavorite Post</a>";
        }
        if($fav == 0) {
            echo "<a style='margin-left:20px;' href='?fav=".$row['id']."'>Favorite Post</a>";
        }
        echo "</p><br>
    </article><br><br>".$fav."
    ";
}
6
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by scarcella
0

What mean "I mean it looks good, but It's erroring up...?" You don't even check your code that it does work or not ? Post what you're trying with that codes and what problem you're getting.

0

Hm.. It's weird because your sidebar works, but this doesn't.

Edited by badcc

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.