douwen7603 2016-10-06 15:37
浏览 45

MySql Insert不起作用,没有显示错误[重复]

This question already has an answer here:

Mysql seems not inserting in my table even if there is no error displayed, I even used

error_reporting(E_ALL);
ini_set('display_errors', '1');

but it always dosent return anything, there is my code:

the connexion file

<?php
class Connexion
{
    public static function cnx()
    {
        try{
            $db=new PDO('mysql:host=localhost;dbname=championship','root','');
            return $db;
        }
        catch(Exception $e){
            die('Erreur :'.$e->getMessage());
        }   
    }
}
?>

the main file

<?php

session_start();
include_once("../cnx.php");
include_once('theme.php');
include_once('criteria.php');

$num_rows=Criteria::countCriteria();

$id_theme=$_GET['id_theme'];
for ($i = 1; ; $i++) {
    if ($i > $num_rows) {
        break;
    }

    Criteria::saveScoreByCriteria($_SESSION['user']['id'],$i,$_POST["mark_criteria$i"],$_POST["comment_criteria$i"],$id_theme);
}

Theme::saveJudgeScore($id_theme,$_SESSION['user']['id'],$_POST["judge_general_comment"]);
header("location:list_theme.php");

?>

and this the function saveScoreByCriteria($id_judge,$id_criteria,$mark,$comment,$id_theme)

<?php
public static function saveScoreByCriteria($id_judge,$id_criteria,$mark,$comment,$id_theme) 
{
    $cnx=new Connexion();
    $db=$cnx->cnx(); 
    $req=$db->prepare("INSERT INTO `judge_criteria`( `id_judge`, `id_criteria`, `mark`, `comment`, `id_theme`) values (:id_judge,:id_criteria,:mark,:comment,:id_theme)");
    $req->execute(array(':id_judge'=>$id_judge,':id_criteria'=>$id_criteria,':mark'=>$mark,':comment'=>$comment,':id_theme'=>$id_theme));

}
?>

Hope that somebody could help me! thanks.

here is the complete error log file

[Thu Oct 06 08:31:40.250444 2016] [mpm_winnt:notice] [pid 7872:tid 292] AH00428: Parent: child process 5128 exited with status 1073807364 -- Restarting.
[Thu Oct 06 08:35:32.354324 2016] [ssl:warn] [pid 5572:tid 296] AH01909: RSA certificate configured for www.example.com:443 does NOT include an ID which matches the server name
[Thu Oct 06 08:35:32.619524 2016] [core:warn] [pid 5572:tid 296] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Thu Oct 06 08:35:33.274725 2016] [ssl:warn] [pid 5572:tid 296] AH01909: RSA certificate configured for www.example.com:443 does NOT include an ID which matches the server name
[Thu Oct 06 08:35:36.925132 2016] [mpm_winnt:notice] [pid 5572:tid 296] AH00455: Apache/2.4.7 (Win32) OpenSSL/1.0.1e PHP/5.5.9 configured -- resuming normal operations
[Thu Oct 06 08:35:36.925132 2016] [mpm_winnt:notice] [pid 5572:tid 296] AH00456: Apache Lounge VC11 Server built: Nov 21 2013 20:13:01
[Thu Oct 06 08:35:36.925132 2016] [core:notice] [pid 5572:tid 296] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Thu Oct 06 08:35:36.956332 2016] [mpm_winnt:notice] [pid 5572:tid 296] AH00418: Parent: Created child process 4244
[Thu Oct 06 08:35:38.251134 2016] [ssl:warn] [pid 4244:tid 308] AH01909: RSA certificate configured for www.example.com:443 does NOT include an ID which matches the server name
[Thu Oct 06 08:35:39.093535 2016] [ssl:warn] [pid 4244:tid 308] AH01909: RSA certificate configured for www.example.com:443 does NOT include an ID which matches the server name
[Thu Oct 06 08:35:39.171535 2016] [mpm_winnt:notice] [pid 4244:tid 308] AH00354: Child: Starting 150 worker threads.
[Thu Oct 06 14:06:00.652885 2016] [mpm_winnt:notice] [pid 5572:tid 296] AH00428: Parent: child process 4244 exited with status 1073807364 -- Restarting.
[Thu Oct 06 14:21:10.787495 2016] [ssl:warn] [pid 1200:tid 296] AH01909: RSA certificate configured for www.example.com:443 does NOT include an ID which matches the server name
[Thu Oct 06 14:21:10.959095 2016] [core:warn] [pid 1200:tid 296] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Thu Oct 06 14:21:11.473896 2016] [ssl:warn] [pid 1200:tid 296] AH01909: RSA certificate configured for www.example.com:443 does NOT include an ID which matches the server name
[Thu Oct 06 14:21:14.709503 2016] [mpm_winnt:notice] [pid 1200:tid 296] AH00455: Apache/2.4.7 (Win32) OpenSSL/1.0.1e PHP/5.5.9 configured -- resuming normal operations
[Thu Oct 06 14:21:14.709503 2016] [mpm_winnt:notice] [pid 1200:tid 296] AH00456: Apache Lounge VC11 Server built: Nov 21 2013 20:13:01
[Thu Oct 06 14:21:14.709503 2016] [core:notice] [pid 1200:tid 296] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Thu Oct 06 14:21:14.740703 2016] [mpm_winnt:notice] [pid 1200:tid 296] AH00418: Parent: Created child process 648
[Thu Oct 06 14:21:16.581506 2016] [ssl:warn] [pid 648:tid 308] AH01909: RSA certificate configured for www.example.com:443 does NOT include an ID which matches the server name
[Thu Oct 06 14:21:17.252307 2016] [ssl:warn] [pid 648:tid 308] AH01909: RSA certificate configured for www.example.com:443 does NOT include an ID which matches the server name
[Thu Oct 06 14:21:17.314707 2016] [mpm_winnt:notice] [pid 648:tid 308] AH00354: Child: Starting 150 worker threads.
</div>
  • 写回答

1条回答 默认 最新

  • doukengzi3517 2016-10-06 15:56
    关注

    This line may be causing you the problem, using static method on non static manner

      $db = $cnx->cnx();
    

    Use this instead

      $db = Connexion::cnx();
    
    评论

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?