i need to know if there is a member whose enrollment date is earlier than a specified date.

If this case, the specified date = $Monday

$Monday = 12-30-2009;
$result = mysql_query("SELECT COUNT(*) FROM agents WHERE (sponsor = '$parent') and  (lft between $leftlft AND $leftrgt) and (enrollment_date >= '$Monday')");

I tested to put a member with enrollment_date as 12-3-2009 but the this results to 0.

So tried to reset the $Monday to 12-29-2009 and returned 1 result.

What do you think is the problem with this code?

Recommended Answers

All 4 Replies

try it this way:

$Monday = 12-30-2009;
$result = mysql_query("SELECT COUNT(*) FROM agents WHERE (sponsor = '$parent') and  (lft between $leftlft AND $leftrgt) and (enrollment_date >= ".$monday);

Well, I just fixed the $monday part. I just noticedthat you have a bunch of vars in there. You have to concatenate the variables to the string segments. like

" query stuff".$myvar."more_query string".$another."last part of query in quotes as well";

That was awesome. What does "." do? Im a newbie. Thanks a lot bro!

It is the concatenate operator.
Call it the glue that binds if you will...

Ok thanks a lot again!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.