[PHP]While Statements

Results 1 to 2 of 2
  1. #1
    C# Developer stealarcher is offline
    MemberRank
    Jan 2008 Join Date
    571Posts

    [PHP]While Statements

    Ok, what I am doing is getting posts from a database (such as a blog) using a while statement. In the while statement I would like to check if the post belongs to the current logged in user, then echo a delete function/link to delete that post if it is theirs. Any idea how I would go about this?


  2. #2
    The Gamma..? EliteGM is offline
    MemberRank
    Jul 2006 Join Date
    NandolandLocation
    4,077Posts

    Re: [PHP]While Statements

    PHP Code:
    $result mysql_query("SELECT * FROM `posts`");
    while(
    $row mysql_fetch_array($result))
    {
        if (
    $row['posted_by'] == $logged_user)
        {
            echo 
    "<a href='delete.php'>[Delete]</a>";
        }

    You'll have to change the vars and just make a delete.php



Advertisement