Hallo , sorry about my English , my knowledge about PHP is very sample…
I to search with a New File my Comment to lose , with these File, kommenter_verwalter.php
<?php
header('Content-Type: text/html; Charset=utf-8');
mb_internal_encoding('UTF-8');
date_default_timezone_set('UTC');
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require "classprove.php";
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;
function ShowForms()
{
?>
<form method="POST">
<br>
<label for="name"><b>Name </b></label>
<input type="text" id="name" name="Name" value="">
<label for="email"><b>E-mail </b></label>
<input type="email" id="email" name="Email" value="">
<br><br>
<label><b> Message * </b><br>
<textarea cols="45" rows="6" id="text" name="Message"></textarea>
</label>
<br><br>
<input type="submit" name="delete" value="delete" id="comment"/>
<br>
</form>
<?php
}
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["id"])) {
try {
$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()
{
if ($statement)
{
echo "<table border=1>";
echo "<tr>";
echo "<th>ID</th>";
echo "<th>Name</th>";
echo "<th>Email</th>";
echo "<th>Message</th>";
echo "<th>Datetime</th>";
echo "<th>IP</th>";
echo "<th>Delete</th>";
echo "</tr>";
foreach ($statement as $row):
echo "<form action=classprove.php method=post>"
. "<tr>"
. "<td>" . htmlspecialchars($row["id"]) . "</td>"
. "<td>" . htmlspecialchars($row["name"]) . "</td>"
. "<td>" . htmlspecialchars($row["email"]) . "</td>"
. "<td>" . htmlspecialchars($row["datetime"]) . "</td>"
. "<td>" . htmlspecialchars($row["ip"]) . "</td>"
. "</tr>";
endforeach;
echo "</table>";
}
}
$Newobjects = new ClassProveContakt2();
$Newobjects -> ShowForms();
$Newobjects -> tabelle();
?>
But nothing to Display … , i to want a Table as these,
[upl-image-preview url=https://board.phpbuilder.com/assets/files/2019-05-18/1558186068-397291-delete.png]
With; sudo tail -n0 -f /var/log/apache2/error.log /var/log/mysql/error.log
to come these error;
Parse error: syntax error, unexpected '<', expecting end of file in /var/www/html/kommenter_verwalter.php on line 50
On Line 50 have my function ShowForm() and it is; <br><br>
Can Please anyone help me for this Problen , Thanks !