Tilmeldt

[insert_php]

$servername = “fambj.dk.mysql”;
$username = “fambj_dk”;
$password = “jbj1024data”;
$database = “fambj_dk”;

// Create connection
$conn = mysqli_connect($servername, $username, $password, $database);

// Check connection
if ($conn->connect_error) {
die(“Connection failed: ” . $conn->connect_error);
}

// antal tilmeldte
$sql = “SELECT DISTINCT `group_id` FROM `wp_formmaker_submits` ORDER BY `group_id`”;
$res = mysqli_query($conn, $sql);

if ($res) {
while ($newArray = mysqli_fetch_array($res, MYSQLI_ASSOC)) {
$antal = $newArray[‘group_id’];
}
echo $antal;
echo ” tilmeldt, “;
echo 100-$antal;
echo ” frie pladser
“;
}
else
{
printf(“Could not retrieve records: %s\n”, mysqli_error($mysqli));
}

// list over navne
$sql = “SELECT `form_id`, `element_label`, `element_value` FROM `wp_formmaker_submits`where `form_id` = 1 and `element_label` = 1 “;
$res = mysqli_query($conn, $sql);

if ($res) {
while ($newArray = mysqli_fetch_array($res, MYSQLI_ASSOC)) {
$element_value = $newArray[‘element_value’];
$element_value = str_replace(“@@@”, ” “, $element_value);
$element_value = mb_convert_encoding($element_value, “UTF-8”, “latin1″);
echo $element_value;
echo ”
“;
}
}
else
{
printf(“Could not retrieve records: %s\n”, mysqli_error($mysqli));
}

$conn->close();

[/insert_php]