dputlf5431 2014-10-24 10:26
浏览 52

PHP脚本在预准备语句中的execute()处停止执行

I have written a php script with prepared statements. on my local xampp server (PHP Version 5.5.15, MYSLQI mysqlnd 5.0.11-dev) It works perfectly. Now changing the Server (PHP Version 5.3.26, MYSQLI 5.1.36) it does not work anymore. It starts executing the script but stops directly before the first get_result() order.

//read DB entries
$sql_topic = "SELECT * FROM topic ORDER BY ID DESC";

$var = "naventry";

//prepared statement
$query = $mysqli->prepare($sql_topic);
$query -> execute();
//-------------------

//topic loop
if ($query = $query->get_result()) {
    while($topic = $query->fetch_assoc()) {

There's no information in the error logs and I don't have a clue where to search for the solution.

I hope for your help!! pplopp

  • 写回答

1条回答 默认 最新

  • douyi4297 2014-10-24 10:34
    关注

    To have more clue about what's wrong, test every output of your code:

    // enable all errors for debugging
    error_reporting(E_ALL);
    ini_set('display_errors', 'On');
    
    $query = $mysqli->prepare($sql_topic);
    if (!$query)
      die($mysqli->error);
    $res = $query->execute();
    if (!$res)
    {
       die($query->error);
    }
    

    Remember to remove theses errors display when putting your code on production (or replace the die() by debug() (you need to write your own), or file_put_contents, error_log, ...

    评论

报告相同问题?

悬赏问题

  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗
  • ¥15 ikuai客户端l2tp协议链接报终止15信号和无法将p.p.p6转换为我的l2tp线路