vendredi 9 août 2019

if condition showing wrong result in PHP

I have following table name"demo" in mysql

id      emp_id              test1           test2
1       3                   12              14
1       3                   15              16

now i fetch records in loop and want to compare(whether saved value come between my values) I tried with following code but not working

$newval="13";
$newval2="15";

if(($test1>$newval || $test1<$newval2) || ($test2>$newval || $test2<$newval2))
{
    echo "already exist";
}
else
{
    echo "do your code";
}

Aucun commentaire:

Enregistrer un commentaire