我有一个会话变量AgreeNum,它动态地插入到我的基于PHP的MySQL查询中。我正在尝试添加名为AgreeNum的第二个会话变量,并且无法找出添加第二个变量的正确语法?这里是片段,每当我尝试在WHERE子句爆炸后添加AND时:
$ParamAgreeNum_WADAsarenewals = "-1";
if (isset($_GET['AgreeNum'])) {
$ParamAgreeNum_WADAsarenewals = (get_magic_quotes_gpc()) ? $_GET['AgreeNum'] : addslashes($_GET['AgreeNum']);
}
$ParamEmail_WADAsarenewals = "-1";
if (isset($_GET['Email'])) {
$ParamEmail_WADAsarenewals = (get_magic_quotes_gpc()) ? $_GET['Email'] : addslashes($_GET['Email']);
}
mysql_select_db($database_home, $home);
$query_WADAsarenewals = sprintf("SELECT AgreeNum, sName, Address1, CityStZip, Email, EffectiveDate, Year1, Year2, Year3, Year4, YearPick, authid, ccinfo FROM sarenewals WHERE AgreeNum = %s", GetSQLValueString($ParamAgreeNum_WADAsarenewals, "text"));我试图在sprintf上更新它,但它不起作用:
$query_WADAsarenewals = sprintf("SELECT AgreeNum, sName, Address1, CityStZip, Email, EffectiveDate, Year1, Year2, Year3, Year4, YearPick, authid, ccinfo FROM sarenewals WHERE AgreeNum = %s", GetSQLValueString($ParamAgreeNum_WADAsarenewals, "text") " AND Email = %s", GetSQLValueString($ParamEmail_WADAsarenewals, "text"));