Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
if(isset($_POST["publikum"])) {
$db = mysqli_connect("localhost", "root", "", "VM");
if (!$db) {
die("Feil i knytning til databasen!");
} else {
echo "knyttet til databse! <br>";
}
$fornavn = $_POST["firstname"];
$etternavn = $_POST["surname"];
$adresse= $_POST["adress"];
$telefon = $_POST["telefonnr"];
$bilett = $_POST["bilett"];
$kategori = $_POST["kategori"];
$sql = "INSERT INTO audience(name,surname,adress,phone,tickettype,excersize)";
$sql .= "VALUES ('$fornavn','$etternavn','$adresse','$telefon','$bilett','$bilett')";
$resultat = mysqli_query($db, $sql);
}
$sql = "SELECT * FROM audience";
$resultat = mysqli_query($db,$sql);
if(!$resultat)
{
echo "FEIL!";
}
echo '<table>';
while ($rad=mysqli_fetch_array($resultat,MYSQLI_ASSOC)) {
echo '<tr>';
echo '<td>'.$rad["name"].'</td>';
echo '<td>'.$rad["surname"].'</td>';
echo '<td>'.$rad["adress"].'</td>';
echo '<td>'.$rad["phone"].'</td>';
echo '<td>'.$rad["tickettype"].'</td>';
echo '<td>'.$rad["excersize"].'</td>';
echo '</tr>';
}
echo '</table>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment