- Edited
Now i have to change a little my code, people help me and found unifier errors...
<?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;
function ShowForms()
{
echo '<form method="POST" action="classprove.php">
<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="post" value="POST COMMENT" id="comment">
</form>';
}
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()
{
if ($sb)
{
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>
</tr>";
foreach ($sb as $row):
echo "<form action=classprove.php method=post>"
. "<tr>"
. "<td>" $row["id"];"</td>"
. "<td>" $row["name"];"</td>"
. "<td>" $row["email"];"</td>"
. "<td>" $row["datetime"];"</td>"
. "<td>" $row["ip"];"</td>"
. "</tr>"
. "</form>";
endforeach;
echo "</table>";
}
}
}
$Newobjects = new ClassProveContakt2();
$Newobjects -> ShowForms();
$Newobjects -> tabelle();
?>
With s
udo tail -n0 -f /var/log/apache2/error.log /var/log/mysql/error.log
to come these error,
Parse error: syntax error, unexpected '$row' (T_VARIABLE), expecting ',' or ';' in /var/www/html/kommenter_verwalter.php on line 106
On Line 106 have;
. "<td>" $row["name"];"</td>"