存储过程
sql注入,通过输入特殊的查询内容破坏原有sql语句的结构,从而导致项目出错。
最典型的sql注入语句:abc' or 1=1#
防止sql注入的方法:进行输入校验,使用存储过程。
存储过程创建:
navicat创建:数据库中,右键点击函数,新建函数。
在参数中输入 IN 参数名 参数类型(长度),其中IN 表示输入
在存储过程里写入
BEGIN
select * from userinfo where username=u and pwd =p;
END
查询:call login('Will','123456');