例如"SELECT * FROM date WHERE name = 'etc' AND lastname = 'etc' AND etc='etc'";
答案 0 :(得分:8)
你完全按照刚刚说的那样去做。
答案 1 :(得分:3)
假设您正在讨论基于PHP输入变量构造查询
$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 );
答案 2 :(得分:0)
你会这样做
eg "SELECT * FROM date WHERE name = 'etc' AND lastname = 'etc' AND etc='etc'";