写sql语句连接的时候注意的一个小细节
2015-07-10 20:16
579 查看
我在写权限的查询的时候,用到了sql语句的链接写一下出错的时候的代码
出错的截图
根据图中的输出就能知道出错的原因了了,sql语句没写对
正确的代码
$sqlpid="select auth_name from sw_auth where auth_level=0"; if(session('mg_id')!=5){ $sqlpid.="and auth_id in ($ids)"; } show($sqlpid);
出错的截图
根据图中的输出就能知道出错的原因了了,sql语句没写对
正确的代码
$sqlpid="select auth_name from sw_auth where auth_level=0"; if(session('mg_id')!=5){ $sqlpid.=" and auth_id in ($ids)"; } show($sqlpid);
相关文章推荐
- Oracle中的函数 字符串、数字、日期
- sqlite3插入日期时间出错解决
- ORACLE查看数据文件包含哪些对象
- 数据库排名sql,group by 分组查询按照时间最大值
- update慢如何处理?
- winfrom连接数据库增删改查写法
- Oracle 11g Pivot函数实现行转列
- 查看Oracle自动优化建议
- orcale sql常用语句
- SQL Server 导入 MDF LDF文件
- [c#]从数据库中用ExecuteScalar()读取值使用(int)强制类型转换发生System.InvalidCastException: 指定的转换无效
- 数据库子函数练习
- 数据库子函数练习
- 为首次部署MongoDB做好准备:容量计划和监控
- mysql优化2
- MySQL数据类型和常用字段属性总结
- 利用mysql的inet_aton()和inet_ntoa()函数存储IP地址的方法分享
- DBeaver通用数据库工具
- Bitnami WordPress如何修改MySQL root的默认密码?
- sql 数据库计算经纬度