php sql错误,PHP,SQL查询错误? (PHP, SQL Query Error?)

博主在尝试使用SQL进行结果分页时遇到了错误:'Fatal error: Call to a member function fetch_assoc() on boolean'。问题出现在包含LIMIT子句的查询上,尽管查询本身能够正确显示所有结果。在其他页面同样的方法工作正常,但在这个特定页面,问题依然存在,博主尚未找出原因。
摘要由CSDN通过智能技术生成

2015-10-05 09:47:55

0

one of the SQL Queries i am using to create pagination among returned results is giving me grief and im unsure as to why, i am presented with this error:

Fatal error: Call to a member function fetch_assoc() on boolean in

---etc ,

which is referring to the query i have below. However, this select statement works perfectly fine in the sense that it displays all the results, but when the LIMIT is added:

$messagequery = 'SELECT m.id, m.msg_date, m.uname,CONCAT(o.firstname, \' \', o.surname) AS \'org_name\', m.email, m.message, m.response

FROM messages AS m

JOIN admin AS o ON m.uname = o.uname

WHERE uname = "'.$_SESSION['uname'].'"

LIMIT $start_from, $num_rec_per_page';

//execute the query

$results = $db->query($messagequery);

-

LIMIT $start_from, $num_rec_per_page';

I recieve the error...

I have done the same thing on multiple pages, and it works, but for this specific page i just cannot figure out why....

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值