I prefer to wrap queries in double quotes.
It looks cleaner than escaping, so makes spotting errors easier
- $vUserActQuery = "SELECT ds_description, ua_busscompid,
-
ua_type, ua_actionid , ua_startdate, ua_enddate, user_comments
-
FROM dms_useraction,status
-
WHERE ua_userid = $vUserId AND ua_actionid = ds_id
-
from this part its wrong help me out
-
AND ua_startdate >= $vStartDate AND ua_startdate <= $vToDate;
-
If I have cleaned this correctly, I can see straight away there are no single quotes around the dates.
I used to make that error.
- AND ua_startdate >= '$vStartDate' AND ua_startdate <= '$vToDate'
But as Atli suggested, BETWEEN is simpler
- AND ua_startdate BETWEEN '$vStartDate' AND '$vToDate'
If $vUserId is a string that needs wrapping in quotes.
DON'T overlook the time element as in my first post.
And may I suggest studying the JOIN command