Daniel
|
| Posted: 06/23/2005, 3:14 AM |
|
I experienced a problem in opOR and opAND when using brackets.
Brackets are not correctly putted in the where clause
When I modified opOR and opAND functions in classes.php like bellow :
(just put the condition if ($Brackets) $strResult = " (" . $strResult . ") "; before return
Am I right or is there some thing else to do ?
New functions
function opAND($Brackets, $strLeft, $strRight)
{
$strResult = "";
if (strlen($strLeft))
{
if (strlen($strRight))
{
$strResult = $strLeft . " AND " . $strRight;
}
else
{
$strResult = $strLeft;
}
}
else
{
if (strlen($strRight))
$strResult = $strRight;
}
if ($Brackets)
$strResult = " (" . $strResult . ") ";
return $strResult;
}
function opOR($Brackets, $strLeft, $strRight)
{
$strResult = "";
if (strlen($strLeft))
{
if (strlen($strRight))
{
$strResult = $strLeft . " OR " . $strRight;
}
else
{
$strResult = $strLeft;
}
}
else
{
if (strlen($strRight))
$strResult = $strRight;
}
if ($Brackets)
$strResult = " (" . $strResult . ") ";
return $strResult;
}
|
|
|
 |
mamboBROWN
Posts: 1713
|
| Posted: 06/23/2005, 7:13 AM |
|
Daniel,
I noticed that you are not using { } around some of your if condition statements. If memory serves me right you are suppose to use { } around all if conditions. Also it may help if you format your conditions in order that it can be more easily understood.
|
 |
 |
|