Solved

using "if" and "strlen()" or "empty()" in PHP

Posted on 2009-07-07
3
891 Views
Last Modified: 2013-12-13
this should be simple, i think.

i need to determine if $sDancers does not contain data and not execute an email. if $sDancers does have data, then send the email.

this is what i have right now, which doesn't work.

could i use empty() instead?
$Zval  = 0;

	

	if (!strlen($sDancers) <> $Zval) {

		mail ($tomb, $subject1, $body1, $header); //email to mario

		}

Open in new window

0
Comment
Question by:ironpen45
  • 2
3 Comments
 

Expert Comment

by:mpete510
ID: 24797704
I believe removing the ! from the if statement should fix your problem.
$Zval  = 0;

        

        if (strlen($sDancers) <> $Zval) {

                mail ($tomb, $subject1, $body1, $header); //email to mario

                }

Open in new window

0
 

Accepted Solution

by:
mpete510 earned 125 total points
ID: 24797712
Also, inequality in PHP is done with !=, not <>.
if (strlen($sDancers) != $Zval)

Open in new window

0
 

Author Closing Comment

by:ironpen45
ID: 31600771
that did it! thanks!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now