dongyu2047 2013-08-08 00:04
浏览 39
已采纳

too long

I'm running the exact same PHP script on two different servers as a web service for an app. One executes all queries (the one running 5.3.15) and the other (running 5.3.10) does not run certain queries. It creates a server error when I tell some of the queries to execute.

The machine running 5.3.15 is a mac os x lion machine, and the other is and ubuntu 12.04.

Do you guys have any idea what could be going wrong. Here are two examples of queries. The first one works on the php 5.3.10 and the second does not.

Working:

$stmt = $this->db->prepare("SELECT DISTINCT b.id
            FROM a
            LEFT JOIN b
            ON a.item_id = v.id
            INNER JOIN c
            ON a.id = c.item_id
            LEFT JOIN d
            ON c.status_id = d.id
            WHERE d.property = 1");

Server Error-ing:

$stmt = $this->db->prepare("SELECT a.id AS id, d.ordering AS ordering,
            d.name AS name2,
            a.service_id AS service_id, b.name AS name, 
            c.name AS name1, a.due_date AS due_date,
            d.status AS status
            FROM a INNER JOIN b
            ON a.title_id = b.id
            LEFT JOIN c
            ON b.tv_show_id = c.id
            LEFT JOIN d
            ON a.status_id = d.id
            WHERE b.provider_id = ? 
            AND (b.film_id= ? OR b.name 
            LIKE CONCAT('%', ?, '%') OR c.name 
            LIKE CONCAT('%', ?, '%')) LIMIT 2000");

Note: I am very open to all sorts of critiques of these queries, but answers that only say that I'm messy or need to read up on sql will not be very helpful to me. Also, the database names are not actually just letters, I have changed them for security purposes.

The problem is most likely to be in the functions used or something, as the code (before I quickly butchered it by changing around all the names) runs flawlessly in php 5.3.15.

If the error makes no sense, then what else could be going wrong? I ran the queries straight in the mysql console and it worked perfectly, but when I bound_params and executed them based off of passed in variables, the second query fails. Any help is appreciated!!

EDIT:

The error message is: caught SIGTERM, shutting down - I'll look into that. Thank you to all commenters who helped!

  • 写回答

1条回答 默认 最新

  • doujian0265 2013-08-08 20:18
    关注

    I realized my problem, and in case someone runs into the same thing, I'm going to share:

    My Ubuntu php did not have mysqldb installed, just plain mysql (the default). So, functions like "fetch_assoc()" and "get_result()" do not work. For a work-around, I referred to the following post:

    Call to undefined method mysqli_stmt::get_result

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?