alin19 Posted March 31, 2008 Share Posted March 31, 2008 i don't get it, what i have wrong here? if ((isset ($_POST['inreg_contract']))=='Inreg Contract') { $query_Sel="SELECT `activ` AS activ FROM `conturi` WHERE `Id_bo`='$id_bo'"; if ($r=mysql_query($query_Sel)) { $row = mysql_fetch_array($r); $activ=$row['activ']; } if (isset ($activ)=='Da') { echo <<<EOF <script language="javascript" type="text/javascript"> <!-- alert ('acest client are deja un cont activ, verificati datele'); --> </script> EOF; echo $activ; } and it outputs: Nu and that alert message, but it should'n outpun nothing because $activ is not "Da" Quote Link to comment https://forums.phpfreaks.com/topic/98858-php-error/ Share on other sites More sharing options...
2levelsabove Posted March 31, 2008 Share Posted March 31, 2008 You are missing a closing brace Quote Link to comment https://forums.phpfreaks.com/topic/98858-php-error/#findComment-505839 Share on other sites More sharing options...
alin19 Posted March 31, 2008 Author Share Posted March 31, 2008 where? this also doesn't work if ((isset ($activ))=='Da') Quote Link to comment https://forums.phpfreaks.com/topic/98858-php-error/#findComment-505841 Share on other sites More sharing options...
rhodesa Posted March 31, 2008 Share Posted March 31, 2008 Remove the isset() from around $activ Quote Link to comment https://forums.phpfreaks.com/topic/98858-php-error/#findComment-505842 Share on other sites More sharing options...
paul2463 Posted March 31, 2008 Share Posted March 31, 2008 try this one if ((isset ($activ))&&($activ == 'Da')) I think yours fails because "isset($activ)" will return true before any comparison is carried out so therefore you get the alert message Quote Link to comment https://forums.phpfreaks.com/topic/98858-php-error/#findComment-505843 Share on other sites More sharing options...
kenrbnsn Posted March 31, 2008 Share Posted March 31, 2008 This line <?php if ((isset ($_POST['inreg_contract']))=='Inreg Contract') ?> doesn't make any sense. You probably want: <?php if (isset ($_POST['inreg_contract']) && $_POST['inreg_contract'] =='Inreg Contract') ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/98858-php-error/#findComment-505844 Share on other sites More sharing options...
alin19 Posted March 31, 2008 Author Share Posted March 31, 2008 try this one if ((isset ($activ))&&($activ == 'Da')) I think yours fails because "isset($activ)" will return true before any comparison is carried out so therefore you get the alert message this work's but i don't get it, i've used that code before and it work's Quote Link to comment https://forums.phpfreaks.com/topic/98858-php-error/#findComment-505845 Share on other sites More sharing options...
alin19 Posted March 31, 2008 Author Share Posted March 31, 2008 This line <?php if ((isset ($_POST['inreg_contract']))=='Inreg Contract') ?> Ken this works just fine, Quote Link to comment https://forums.phpfreaks.com/topic/98858-php-error/#findComment-505846 Share on other sites More sharing options...
kenrbnsn Posted March 31, 2008 Share Posted March 31, 2008 You may think it works fine, but it's not doing what you think it is supposed to do. That condition will never evaluate to "true", since the isset() function will return either "true" or "false", which will never be equal to "Inreg Contract". Ken Quote Link to comment https://forums.phpfreaks.com/topic/98858-php-error/#findComment-505853 Share on other sites More sharing options...
paul2463 Posted April 1, 2008 Share Posted April 1, 2008 if you are doing more than a simple IF statement you have to breakdown exactly what you want in the case I answered if ((isset ($activ))=='Da') //your code if ((isset ($activ))&&($activ == 'Da')) //my code in your code the first thing that happens is it checks to see if $active is set, if its true, then nothing else gets checked because there is no conditional statement for another check in my code it checks to see if $active is set (true) then because of the extra conditional "&&" it also checks to see if its equal to "Da" Quote Link to comment https://forums.phpfreaks.com/topic/98858-php-error/#findComment-506381 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.