我想问点什么。。
我陷入了与 jquery 结合的 sql 查询中,即 dropdown.val()..
echo "<script type='text/javascript'>";
echo "$(document).ready(function () {
$('#ddlstatename').change(function(){";
echo "alert ($('#ddlstatename').val());";
$result6 = mysql_query("SELECT companyname FROM tb_company com inner join tb_companyinfo std on com.stateid = std.stateid and com.companyid = std.companyid WHERE std.productid = 1 AND std.stateid = '"$('#ddlstatename').val()"'");
echo "});";
echo "});</script>";
我尝试弹出一个:echo "alert ($('#ddlstatename').val());";
它具有下拉列表中的值(dllstatename 是下拉列表 ID)..
但是当我将它插入到 sql 查询中时
$result6 = mysql_query("SELECT companyname FROM tb_company com inner join tb_companyinfo std on com.stateid = std.stateid and com.companyid = std.companyid WHERE std.productid = 1 AND std.stateid = '"$('#ddlstatename').val()"'");
我收到错误:std.stateid = '"$('#ddlstatename').val()"'"..
如何更改$('#ddlstatename').val()
into sql 查询语句?
非常感谢你的帮助!