$page_title"; ?> $db = new mysqli(DBHOST, DBUSER, DBPASS, DBDATABASE); //$db = new mysqli(DBHOST, DBUSER, DBPASS, DBDATABASE); if($db->connect_errno > 0) { die("Fel vid anslutning: " . $db->connect_error); } if(isset($_POST['user'])) { $user = $_POST['user']; $content = $_POST['content']; // Lägg till data $sql = "INSERT INTO guestbook(user, content)VALUES('$user', '$content')"; $result = $db->query($sql); } ?>Lämna en kommentarDitt namn:Ditt meddelande: // SQL-fråga $sql = "SELECT * from guestbook ORDER BY created DESC"; $result = $db->query($sql); while($row = $result->fetch_assoc()) { ?> } ?>
$db = new mysqli(DBHOST, DBUSER, DBPASS, DBDATABASE); //$db = new mysqli(DBHOST, DBUSER, DBPASS, DBDATABASE); if($db->connect_errno > 0) { die("Fel vid anslutning: " . $db->connect_error); } if(isset($_POST['user'])) { $user = $_POST['user']; $content = $_POST['content']; // Lägg till data $sql = "INSERT INTO guestbook(user, content)VALUES('$user', '$content')"; $result = $db->query($sql); } ?>Lämna en kommentarDitt namn:Ditt meddelande: // SQL-fråga $sql = "SELECT * from guestbook ORDER BY created DESC"; $result = $db->query($sql); while($row = $result->fetch_assoc()) { ?> } ?>