Created
March 13, 2015 20:15
-
-
Save AndreasJacobsen/b696071c4392326921bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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