First of all, I am not getting any errors but it still doesn't work. I simply want to insert in my table... I've also tryed
mysqli_query($db, "INSERT INTO Rangliste2 (name, score) VALUES ('$text', $zahl)");
before, with the same, unsatisfying result.
<?php>
// score speichern
$zahl = $_POST["text2"];
// name speichern
$text = $_POST["text1"];
if($text == null){
echo("Keinen Text empfangen.");
}
// verbindung zu db herstellen
$db = @new mysqli("...", "...", "...", "...");
if($db->connect_error){
die("<pre>".$db->connect_error."</pre>");
}
$sql = $db->query("INSERT INTO Rangliste2 (name, score) VALUES ('$text', $zahl)");
//sql abfrage
$sql = $db->query("SELECT * FROM Rangliste2 ORDER BY score DESC");
$num = $sql->num_rows; // anzahl der Datensätze
if($num > 0){
while($row = $sql->fetch_object()){
echo ("$row->name: $row->score
");
}
}
?>
When I look at my db table, nothing has been inserted... I appreciate every answer !