Created
March 13, 2015 18:29
-
-
Save AndreasJacobsen/ab0abf7222f9dd0fd1fe 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["next"])) { | |
/*$db = mysqli_connect("localhost", "root", "", "VM"); | |
if (!$db) { | |
die("Feil i knytning til databasen!"); | |
} else { | |
echo "knyttet til databse! <br>"; | |
}*/ | |
$db = new mysqli("localhost", "root", "", "VM"); | |
$db->set_charset("utf8"); | |
$fornavn = $_POST["firstname"]; | |
$etternavn = $_POST["surname"]; | |
$adresse = $_POST["adress"]; | |
$tlf = $_POST["telefonnr"]; | |
$bilett = $_POST["bilett"]; | |
$kategori = $_POST["kategori"]; | |
$sql = "INSERT INTO competitor(name,surname,nationality,excersize)"; | |
$sql .= "VALUES ('$fornavn','$etternavn','$nasjonalitet','$droppliste')"; | |
//$resultat = mysqli_query($db, $sql); | |
$resultat = $db->query($sql); | |
$sql = "SELECT * FROM competitor"; | |
//$resultat = mysqli_query($db,$sql); | |
if (!$resultat) { | |
echo "FEIL! ", $db->error; | |
} | |
echo '<table>'; | |
//while ($rad=mysqli_fetch_array($resultat,MYSQLI_ASSOC)) { | |
for($i = 0 ; $i < $db->affected_rows; $i ++){ | |
$radObject = $db->fetch_object() ; | |
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 '<td>' . $radObject->name . '</td>'; | |
echo '<td>' . $radObject->surname . '</td>'; | |
echo '<td>' . $radObject->adress . '</td>'; | |
echo '<td>' . $radObject->phone . '</td>'; | |
echo '<td>' . $radObject->tickettype . '</td>'; | |
echo '<td>' . $radObject->excersize . '</td>'; | |
echo '</tr>'; | |
} | |
echo '<table>'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment