Hello everyone.
(if you want a quick description of the problem skip this part)
I'm currently developing a website that manages our soccer games. It has a userlist and a gamelist stored in a mysql table.
The userlist table is called 'usuários' and the game table is called 'jogos'.
This table jogos has the following fields: id, data (day), conf (confirmed players), nconf (not confirmed), criado (day the game was created).
What I wanna do is creating a page where is possible to create a game in a certain day, then list all the users registered so the admin can pick who's gonna play.
After that, everyone that is confirmed should be put on the conf part of the table, while those who didn't confirm should be shown on the nconf part of the table.
(and look here)
However, this is giving me some trouble right now. I do not know how can I list every player not yet confirmed on a column of a table.
My code is given below
<?php
require_once("configs.php");
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Criar Pelada</title>
<script language="javascript" src="calendar.js"></script>
</head>
<body>
<div id="registro">
<form action="" method="post" name="form1">
<input type="hidden" name="criarpelada" />
<select name="dia">
<?php
//seletor de dias
$i;
for ($i = 1; $i<32; $i++) {
echo ("<option value=".$i.">".$i."</option>");
}
?>
</select>
<select name="mes">
<?php
//seletor de mês
$m;
for ($m = 1; $m<13; $m++) {
echo ("<option value=".$m.">".$m."</option>");
}
?>
</select>
<select name="ano">
<?php
//seletor de ano
$a;
for ($a = 12; $a<15; $a++) {
echo ("<option value=".$a.">".$a."</option>");
}
?>
</select>
<?php
$buscar = "SELECT * FROM usuarios";
$listar = $con->query($buscar);
if ($listar->num_rows > 0) {
echo ("<p>Quem está convidado?</p><br>");
while ($encontrado = $listar->fetch_object()) {
echo("<input type=\"checkbox\" name=\"confirm\"> ".$encontrado->first." ".$encontrado->last."<br>"); //listar usuário
}
}
//adicionar usuários à lista de nao confirmados
if ($_POST['confirm']) {
}
$dd = $_POST['dia'];
$mm = $_POST['mes'];
$aa = $_POST['ano'];
$data = strtotime($dd."-".$mm."-".$aa);
//test
//echo ($data);
//$criar = $con->query("INSERT INTO jogos (data,conf,nconf,criado) VALUES ('$data','$conf','$nconf',now())");
//echo("<p>Pelada criada no dia ".$dd."/".$mm."".$aa."</p><br>
// <p>Você está automaticamente confirmado</p>");
?>
<input type="submit" name="enviar"/>
</form>
</div>
</body>
</html>
ps: I know there are a lot of php calls, and I did so because the processing happens in the same page.