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 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测