0

eg "SELECT * FROM date WHERE name = 'etc' AND lastname = 'etc' AND etc='etc'";

3
  • 4
    Question is not clear. You have already constructed a query. Commented Apr 16, 2011 at 15:31
  • what exactly is the question here? Commented Apr 16, 2011 at 15:32
  • I'm assuming you mean, How would I construct a mysql query to use multiple AND operators using a language other than SQL. If that is what you mean, better say so... Commented Apr 16, 2011 at 15:36

3 Answers 3

8

You do it exactly like you just said.

Sign up to request clarification or add additional context in comments.

Comments

2

Assuming you are talking to construct query based on PHP input variables

$fields = array( "name", "lastname", "etc" ) ;
foreach( $fields as $field)
{
   $clause[]=$field."='".mysql_real_escape_string($_POST[$field])."'";
}
$query = "SELECT * from `date` where "
         .implode( " AND ", $clause );

Comments

0

you'll do it like this

eg "SELECT * FROM date WHERE name = 'etc' AND lastname = 'etc' AND etc='etc'";

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.