ixian
04-20-2004, 04:03 PM
Say I have this code:
{
$sqlstr .= " AND bugs.stateid=$state";
}
Which does the following: When a link has the specific stateid in it, such as
www.test.com/bugs.php?state=1
Only items with a state of "1" are returned. This works just dandy.
Now, what I want to do is code it so that I can have a url that returns all states BUT 1. So for example, if I want to view states 1 and 2, but not 3. This is to hide tickets with a "closed" state (state 3) in vbbugs, in case anyone was wondering.
I've come up with this:
if ($state)
{
if( $state == "active" )
{
$sqlstr .= " AND bugs.stateid!=3";
}
else
{
$sqlstr .= " AND bugs.stateid=$state";
}
}
Where, if the url www.test.com/bugs.php?state=active was received, all states but state 3 would be displayed, but that doesn't seem to be working.
Obviously there is a mistake there, but I can't spot it. Any ideas? Or even a better way to do this? All I am trying to do in the end is give an option to hide closed bugs/tickets from the default display.
Thanks
{
$sqlstr .= " AND bugs.stateid=$state";
}
Which does the following: When a link has the specific stateid in it, such as
www.test.com/bugs.php?state=1
Only items with a state of "1" are returned. This works just dandy.
Now, what I want to do is code it so that I can have a url that returns all states BUT 1. So for example, if I want to view states 1 and 2, but not 3. This is to hide tickets with a "closed" state (state 3) in vbbugs, in case anyone was wondering.
I've come up with this:
if ($state)
{
if( $state == "active" )
{
$sqlstr .= " AND bugs.stateid!=3";
}
else
{
$sqlstr .= " AND bugs.stateid=$state";
}
}
Where, if the url www.test.com/bugs.php?state=active was received, all states but state 3 would be displayed, but that doesn't seem to be working.
Obviously there is a mistake there, but I can't spot it. Any ideas? Or even a better way to do this? All I am trying to do in the end is give an option to hide closed bugs/tickets from the default display.
Thanks