
public ArrayList<emp>getAllEmp() {
ArrayList<emp>list=new ArrayList<emp>()
Connection con=this.getCon()
Statement ste=null
ResultSet rs=null
try {
ste=con.createStatement()
rs=ste.executeQuery("select * from emp")
while(rs.next()){
emp em=new emp(rs.getInt(1),rs.getString(2),rs.getString(3),rs.getInt(4))
list.add(em)
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace()
}
return list
}
$username = 'dabao0120'res = mysql_query(&my_connection, "SELECT
username, password FROM user WHERE username = '$username'")
能看明白吗?这是php的写法 你要注意的就是 查询语句字段为字符型的时候 需要用引号引起来
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)