select statemnt with mulitple and condination in php

i just tried to use this sql statement to do a selection :

$sql ="SELECT meetingDate FROM  meetingTable WHERE meetingMonth='$monthVal' AND signed='N' AND taken='N'" ;

i used two and here. is there a syntax error?

thanks so much for your reply!
lilyyanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

carchitectCommented:
$sql ="SELECT meetingDate FROM  meetingTable WHERE meetingMonth='{$monthVal}' AND signed='N' AND taken='N' " ;
0
lilyyanAuthor Commented:
>>{$monthVal}

may you explain why use { } ?  thanks for your reply
0
Rok-KraljCommented:
$sql ="SELECT meetingDate FROM  meetingTable WHERE meetingMonth='".$monthVal."' AND signed='N' AND taken='N'" ;

{} is for php to threat this as variable. You have faster solution above.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

carchitectCommented:
0
lilyyanAuthor Commented:
based on carchitect:'s reply, i don't have to use a { } in the above select statement.
0
lilyyanAuthor Commented:
based on carchitect:'s reply, i don't have to use a { } in the above select statement ?
0
Rok-KraljCommented:
Look at my solution above, and no, you don't have to use {}... It is just slower method to do something.
0
lilyyanAuthor Commented:
anyway last question:

why you use two dot (.) beside the variable?
0
Rok-KraljCommented:
dot sign is for merging more strings into one...

example:

$string='one'.'and'.'two';



Have you tried if my solution works?

If you have anything more to ask, just do it :D
0
lilyyanAuthor Commented:
well, i would say:

$sql =" SELECT meetingDate FROM  meetingTable WHERE meetingMonth='$monthVal' AND signed='N' AND taken='N'" ;   // is correct ?


don't have to use: WHERE meetingMonth=='".$monthVal."'  //  don't have to use the dot sign and double
                                                                                             //quation mark ?
0
Rok-KraljCommented:
Yes, it is also correct what you wrote above... :D

This is because php founds $ sign in string and interprets $monthVal as value, because next character (') isn't valid for name.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.