Immer wenn versuche die Datei classprove.php zu mein kommenter_verwalter.php zu bringe , bringe mir Probleme... deshalb versuche jetzt ohne sie…
Wie meine kommenter_verwalter.php jetzt aussiehst,
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
class ClassProveContakt2
{
private $dbHost = 'localhost'; # Host der Datenbank
private $dbName = 'meine'; # Name der Datenbank
private $dbUser = 'root'; # Name phpmyadmin
private $dbPass = 'pass'; # Passwort
private $Name;
private $Email;
private $Message;
private $PostOK;
private $datetime;
private $items;
private $ip;
private $db;
function CommentToDatabase()
{
// Establish connection with MYSQL Server
try
{
$db = new PDO("mysql:host=localhost;dbname=meine", "root", "pass");
}
catch (PDOException $pe)
{
echo "<br>Cannot connect to database: " . $pe->getMessage();
return false;
}
if(isset($_POST["delete"])) {
try {
require classprove.php;
$connection = new PDO($id, $name, $email, $message, $datetime, $ip);
$id = $_POST["id"];
$sql = "DELETE FROM mela WHERE id = :id";
$statement = $connection->prepare($sql);
$statement->bindValue(':id', $id);
$statement->execute();
$success = "User successfully deleted";
}catch(PDOException $error) {
echo $sql . "<br>" . $error->getMessage();
}
}
}
function tabelle()
{
$db = $this ->CommentToDatabase();
if ($db)
{
echo "<table id='user' class='table table-bordered'>
<tr>
<th>id</th>
<th>name</th>
<th>email</th>
<th>message</th>
<th>datetime</th>
<th>ip</th>
<th>Delete User</th>
</tr>";
foreach ($db as $row){
echo <<<EOT
<tr>
<td>{$row['id']}</td>
<td>{$row['name']}</td>
<td>{$row['email']}</td>
<td>{$row['message']}</td>
<td>{$row['datetime']}</td>
<td>{$row['ip']}</td>
<td><button type "submit" name="delete" value="{$row['id']}">löschen</button>
</tr>
EOT;
}
echo "</table>";
}
}
}
$News = new ClassProveContakt2;
$News -> CommentToDatabase();
$News -> tabelle();
?>
mit sudo tail -n0 -f /var/log/apache2/error.log /var/log/mysql/error.log
bekomme keine Warnung mehr , aber auch zeigt nichts...