This topic is locked

IF THEN event

7/14/2014 11:18:17 PM
PHPRunner General questions
D
dspolans author

Why would this only return "YES" regardless if the record exists? I have this in the before display event...

$rs = CustomQuery("SELECT concat(zip, phonenumber) as zipphone FROM do_not_call WHERE concat(zip, phonenumber) = '".$data['phone1']."'");

$record = db_fetch_array($rs);
if (!$record["zipphone"])

{
$xt->assign("my_demo_text","YES");

}

else

{
$xt->assign("my_demo_text","NOPE");

}
Sergey Kornilov admin 7/15/2014

It's not clear what event do you use but try something like this.

$rs = CustomQuery("SELECT concat(zip, phonenumber) as zipphone FROM do_not_call WHERE concat(zip, phonenumber) = '".$data['phone1']."'");

$record = db_fetch_array($rs);
if (!$record)

{

$xt->assign("my_demo_text","YES");

}

else

{

$xt->assign("my_demo_text","NOPE");

}