Jump to content

Recommended Posts

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"

Link to comment
https://forums.phpfreaks.com/topic/98858-php-error/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/98858-php-error/#findComment-505853
Share on other sites

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"

 

Link to comment
https://forums.phpfreaks.com/topic/98858-php-error/#findComment-506381
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.