Page 1 of 1

How to use If Condition in PHP ?

Posted: Wed Aug 17, 2011 3:50 am
by latika
Hi, I need some help figuring out how to have a only print, if the choices within then have data. The evaluation that gives the data is done using if statements. This is the result of the data in the system.

Agents=24,36,34 (these is evaluated using if statements)
Campaigns=0
Team=1


Could you Guide me on how to use IF conditional statements or other conditions like Switch,Choose ?

eg.

if(Agents!="")
{
select * from table where agentID='23'
}
else if(Campaigns!="" || Team!=1)
{
select * from table where CampaignsID='23'
}


Image

How do I go about doing so? or any other solution.


Thank You,

How to use If Condition in PHP ?

Posted: Thu Aug 18, 2011 3:13 am
by HighAley
Hello.
latika wrote:Hi, I need some help figuring out how to have a only print, if the choices within then have data. The evaluation that gives the data is done using if statements. This is the result of the data in the system.

Agents=24,36,34 (these is evaluated using if statements)
Campaigns=0
Team=1


Could you Guide me on how to use IF conditional statements or other conditions like Switch,Choose ?

eg.

if(Agents!="")
{
select * from table where agentID='23'
}
else if(Campaigns!="" || Team!=1)
{
select * from table where CampaignsID='23'
}


Image

How do I go about doing so? or any other solution.
Please, try to use this expression

Code: Select all

 select * from table where {Switch(Agents!="", "agentID='23'", Agents=="" && (Campaigns!="" || Team!=1), CampaignsID='23')}
Agents, Campaigns and CampaignsID must be variables.

Thank you.

How to use If Condition in PHP ?

Posted: Sat Dec 03, 2011 4:52 am
by Berenice29
I want to know if there is a way to use something like this:

$t1=1;
$t2=2;
$t3="$t1>$t2";

if($t3)
echo "Greater";
else
echo "Smaller";
This will evaluate to true as $t3 is a string, but that's wrong!!!

So is there a way to include the if condition inside string.

How to use If Condition in PHP ?

Posted: Mon Dec 05, 2011 3:38 am
by HighAley
Hello.

Where do you want to write a condition exactly in the SQL query or in the report expression?

Thank you.