即使没有显示错误,Mysql似乎也没有插入我的表中,我甚至使用了
error_reporting(E_ALL);
ini_set('display_errors', '1');
但它总是会返回任何东西,有我的代码:
连接文件
<?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());
}
}
}
?>
主文件
<?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");
?>
这个功能
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));
}
?>
希望有人能帮助我! 感谢。
这是完整的错误日志文件
[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.
答案 0 :(得分:0)
此行可能会在非静态方式下使用static
方法导致问题
$db = $cnx->cnx();
改为使用
$db = Connexion::cnx();