duanhuan7750 2012-08-16 02:52
浏览 21

too long

Ok here's the short hands on, i have custom function that runs 8 MySQL queries SELECT, UPDATE, DELETE. Now i have strict standards on so i had to remove error message each time i run query. So i did error_reporting(0); and next query then error_reporting(-1)

        $add_log = "INSERT INTO ac_cand_log
                        (
                            id,
                            action,
                            time
                        )
                      VALUES
                        {$var}";
        $error_reporting = error_reporting();
        error_reporting(0);
        MysqlFns::ExecuteQuery($add_log, "insert");
        error_reporting($error_reporting);

Now i am confused because i run the function and it does not produce necessary result for some reason. I am sure it run until the end. Does switching error reporting level can drive php/mysql nuts?

I also just imported backup database moments before it happened. I know this happened to me before when i just started working on this project and imported database i could not trace why and then it stopped.

Basically i set error_reporting(-1); in all queries in function and put die; at the end funny thing it showed strict standard warning and no other warnings for each query that executed however database was untact and when i refresh page all records was the same as before running query.

Can someone solve this mastery for me?

  • 写回答

3条回答 默认 最新

  • duancilan5124 2012-08-16 02:59
    关注

    You need a function like this

    function skip($boolean = true) {
        if($boolean) {
             error_reporting(0);
        }
        else {
             error_reporting(E_ALL | E_STRICT);
        }
    

    Before query,

    skip(true);
    #Query here#
    

    after query, need to turn error_reporting to default

    skip(false);
    

    and if not useful, you need show your mysql function use to query

    评论

报告相同问题?

悬赏问题

  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数