CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Problem with Bracket in opOR and opAND

Print topic Send  topic

Author Message
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.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.