我有一个问题
Notice: Trying to get property of non-object in /home/u509660713/public_html/panel/inc/pages/adminpanel.p.php on line 66
致命错误:未捕获异常'PDOException',消息'SQLSTATE [23000]:完整性约束违规:1062 / home / u509660713 / public_html / panel / inc / pages / adminpanel中的密钥'PRIMARY'重复输入'0' .p.php:68堆栈跟踪:#0 /home/u509660713/public_html/panel/inc/pages/adminpanel.p.php(68):PDOStatement-> execute(Array)#1 / home / u509660713 / public_html / panel / inc / Config.class.php(267):include('/ home / u50966071 ...')#2 /home/u509660713/public_html/panel/index.php(9):config :: getContent()# 3 {main}投放在第68行的/home/u509660713/public_html/panel/inc/pages/adminpanel.p.php
这是问题。
这是代码:
<?php
if(isset($_POST['name23']) && isset($_POST['level23']) && isset($_POST['adminhelper']))
{
if($_POST['adminhelper'] == "1") {
$admin = 1;
} else {
$admin = 2;
}
$helper = array(
1 => "Admin",
2 => "Helper"
);
if($_POST['level23'] >= 1) {
if($_POST['adminhelper'] == "1") {
$q = Config::$g_con->prepare('UPDATE `users` SET `Admin` = ? WHERE `name` = ?');
$q->execute(array($_POST['level23'],$_POST['name23']));
$texttt = "<b>AdmPanel:</b> Admin". Config::getData('users','name',$_SESSION['user']) ." <b>set</b> player ". Config::getID('users','name',$row->playername) .", admin: `enter code here`<b>".$_POST['level23']."</b>";
$q = Config::$g_con->prepare('INSERT INTO `log_admin` (`iD`, `log`, `time`) VALUES (?, ?, ?)');
$q->execute(array($texttt,Config::getData('users','name',$_SESSION['user']),Config::$_url[0]));
} else {
$q = Config::$g_con->prepare('UPDATE `users` SET `Helper` = ? WHERE `name` = ?');
$q->execute(array($_POST['level23'],$_POST['name23']));
}
echo '<div class="alert alert-danger">Ai setat '. htmlspecialchars($helper[$_POST['adminhelper']]) .' <b>'. htmlspecialchars($_POST['level23']) .'</b> utilizatorului <b>'. htmlspecialchars($_POST['name23']) .'</b>!</div>';
} else {
echo '<div class="alert alert-danger">Nu poti seta nivelul 0 unui admin. Pentru asta poti folosi functia de remove de la sectiunea Staff</div>';
}
}
?>
这是数据库
请帮帮我