mysql语句中的冒号是什么意思?
回复讨论(解决方案) $db->bandvars(); 传递值
echo $check_query; 就知道了。
可以看看手册的pdo类
prepare('select name, colour, calories from fruit where calories bindparam(':calories', $calories, pdo::param_int);$sth->bindparam(':colour', $colour, pdo::param_str, 12);$sth->execute();?>
没有别的意思符号而已,以便区别于 sql 的语法成分
bindvars 方法将定义的符号与实际的变量关联起来
example #1 execute a prepared statement with named placeholdersprepare('select name, colour, calories from fruit where calories bindparam(':calories', $calories, pdo::param_int);$sth->bindparam(':colour', $colour, pdo::param_str, 12);$sth->execute();?>example #2 execute a prepared statement with question mark placeholdersprepare('select name, colour, calories from fruit where calories bindparam(1, $calories, pdo::param_int);$sth->bindparam(2, $colour, pdo::param_str, 12);$sth->execute();?>
大神,以下mysql 语句用来查询排名,在mysql 中能执行,但是s2sh 框架中就不行,你能指点一下吗?
select t.*,@rownum:=@rownum+1 as rownum
from (select sum(yjb_yji) as total,yyryusername,yjb_yyry_id
from yjb where month(createtime) =month(now()) and year(createtime)=year(now())
group by yjb_yyry_id order by total desc) t,(select @rownum:=0) r
报此bug: org.hibernate.queryexception: space is not allowed after parameter prefix ':'