Page 1 of 1

Forum 2

Posted: Fri Jun 28, 2002 9:25 am
by Data
I print out my posts using a while statement.

Some posts however may have been deleted, although they are actually still there, just with a message that says they were deleted.
Each post has an edit and delete option.

However, I don't want this available for a post that has been deleted.

I tried this:

Code: Select all

while ($myrow = mysql_fetch_array( $threadresult )) 
{
if ( $myrowї'deleted'] = 1 )
{
//print posts that have been deleted, without the edit/delete option.
}
		
elseif ( $myrowї'deleted'] = 0)
{
//print posts that haven't been deleted, with the edit/delete option.		
}
}
This didn't work - it made all the posts be viewed without the edit option.

Is there any other way to do this?

Posted: Fri Jun 28, 2002 9:33 am
by twigletmac
You need two equals signs for if loop comparisons, try:

Code: Select all

while ($myrow = mysql_fetch_array( $threadresult )) { 
    if ( $myrowї'deleted'] == 1 ) { 
        //print posts that have been deleted, without the edit/delete option. 
    } elseif ( $myrowї'deleted'] == 0) { 
        //print posts that haven't been deleted, with the edit/delete option.       
    } 
}
Otherwise you just set the value of the variable to whatever it was you were trying to compare it against.

Mac

Posted: Fri Jun 28, 2002 10:36 am
by Data
Thankyou.

Works perfectly!

Posted: Fri Jun 28, 2002 11:09 am
by jason
twigletmac: "if loop comparisons" hrm? Hehe..we now have an if loop?

/me being smart ass

:D

Posted: Fri Jun 28, 2002 11:11 am
by twigletmac
:P