谁给我看看这代码为什么不能用电话来查询数据库呢
当我用电话来查询的时候总是执行了out.print( " <script> alert( '无此帐号,请重新输入 ');history.back(); </script> "); 这句,问题出在哪呢
<%@ include file= "conn.jsp "%>
<%
if ((accout!=null))
{
String sql= "select * from name where accout= ' "+accout+ " ' ";
rs = statement.executeQuery(sql);
if (rs.next())
{
accout=rs.getString( "accout ");
%>
<center> <a href= "# " onClick= "javascript:if(confirm( '确定删除吗? ')){location.href= 'delete1.jsp?accout= <%=accout%> ';} "> 删除帐号 <%=accout%> </a>
<%
rs.close();
}
else
{
out.print( " <script> alert( '无此帐号,请重新输入 ');history.back(); </script> ");
}
}
else
{
String sql= "select * from name where phone= ' "+phone+ " ' ";
rs = statement.executeQuery(sql);
if (rs.next())
{
phone=rs.getString( "phone ");
%>
<center> <a href= "# " onClick= "javascript:if(confirm( '确定删除吗? ')){location.href= 'delete1.jsp?phone= <%=phone%> ';} "> 删除电话 <%=phone%> </a>
<%
rs.close();
}
else
{
out.print( " <script> alert( '无此电话,请重新输入 ');history.back(); </script> ");
}
statement.close();
connection.close();
}
%>
------解决方案--------------------判断问题。把if ((accout!=null))改成if (accout!=null&&! "