atxlin 发表于 2010-5-11 11:18:21

sql语句问题

本帖最后由 atxlin 于 2010-5-11 11:24 编辑

/*$this->db->where("seller", "$user");
   
   $this->db->order_by("sort", "asc");
   
   $query=$this->db->get('custom',$config['per_page'],$this->uri->segment(3));*/




   
   $sql = "select * from custom where seller = '$user' order by sort limit $this->uri->segment(3),$config['per_page']";

把sql语句换了就出现问题了,大家帮忙看下是否正确这样写。

Hex 发表于 2010-5-11 13:33:20

:L 字符串怎么能这么拼接啊??????
$sql = "select * from custom where seller = '$user' order by sort limit ".$this->uri->segment(3).",".$config['per_page'];

PHP 基础很重要 -_-

lianke123 发表于 2013-9-21 19:57:53

Hex 发表于 2010-5-11 13:33 static/image/common/back.gif
字符串怎么能这么拼接啊??????
$sql = "select * from custom where seller = '$user' order by s ...

怎样针对 $this->uri->segment(3) 这里输入的不是数字?

Hex 发表于 2013-9-22 09:55:23

lianke123 发表于 2013-9-21 19:57 static/image/common/back.gif
怎样针对 $this->uri->segment(3) 这里输入的不是数字?

做校验,可以用 PHP 函数或者正则做是否为数字的验证,不是数字就返回给用户一个错误页面。

dayrui 发表于 2013-9-22 10:04:05

lianke123 发表于 2013-9-21 19:57 static/image/common/back.gif
怎样针对 $this->uri->segment(3) 这里输入的不是数字?

(int)$this->uri->segment(3)

li54417083 发表于 2013-9-26 12:59:34

intval()$this->uri->segment(3))
页: [1]
查看完整版本: sql语句问题