j'ai un script ou je depouille les resultats d'un jeu.
j'affiche le nom, prenom et id des gagnants sur ma page avant de valider et de leur envoyer un email.
afin d'envoyer un email je dois recuperer les ID des gagnants et les envoyer dans une autre page.le truc: je peux avoir entre 1 et X gagnants. donc je dois passer les ID dans l'url via un tableau.
la question est : comment?
je ne vois pas commetn envoyer les ID correctement via l'url.
une autre boucle while?
merci!
<?php
session_start();
if (isset($_SESSION['level']) && $_SESSION['level'] == 2)
{
}
else
{
$_SESSION['error'] = "3";
header('Location: ../../errors/error.php');
}
require('../../includes/config.php');
//retrieve id_gifts + stock from teh address bar and secure the variables
$id_gifts = (isset($_GET['id_gifts']))?$_GET['id_gifts']:'';
$id_gifts = mysql_real_escape_string(htmlentities($id_gifts, ENT_QUOTES));
$stock = (isset($_GET['stock']))?$_GET['stock']:'';
$stock = mysql_real_escape_string(htmlentities($stock, ENT_QUOTES));
//select a random number of participants regardless of how many tickets they have played. limitation to the stock.
$query = sprintf("SELECT gifts_played.id_clients, clients.fname, clients.lname
FROM gifts_played, clients
WHERE id_gifts = '$id_gifts'
AND clients.id_clients = gifts_played.id_clients
GROUP BY id_clients
ORDER BY RAND()
LIMIT $stock",
mysql_real_escape_string($id_gifts)
);
$result = mysql_query($query) or die('Query failed. ' . mysql_error());
//starts the table here (outside php code)
?>
<table width="500" border="0">
<tr>
<td>Id</td>
<td>First Name</td>
<td>Last Name</td>
</tr>
<?php
//shows the name and id of winners
$winners = array();
$i=0;
while ($row = mysql_fetch_assoc($result))
{
print"
<tr>
<td>$row[id_clients]</td>
<td>$row[fname]</td>
<td>$row[lname]</td>
</tr>
";
$winners[]= "$row[id_clients]";
$i++;
}
?>
<tr>
<td colspan="4"> mettre un lien ici vers process_winners.tpl.php?winners=tableau ici???</td>
</tr>
</table>