Lesen von Daten aus mehreren Tabellen .... . Kann jemand herausfinden, warum dieser Code nicht funktioniert ... . Wenn ich eine Checkbox auswähle, wird der Alarm (Skript) angezeigt, . Ich weiß, da sollte ein Ergebnis von Daten kommen. . Manny Dank, BennyLesen von Daten aus mehreren Tabellen
<?php
include_once 'dbcon.php';
if(isset($_POST['chk'])=="")
{
?>
<script>
alert('Er moet tenminste één checkbox geselecteerd zijn !!!');
window.location.href='../EVENT/eventIndex.php';
</script>
<?php
}
$chk = $_POST['chk'];
$chkcount = count($chk);
?>
<form method="post" name="frm">
<table width="90%" align="center" border="0">
<tr>
<td colspan="6"><a href="NewTicket.php" class="StyleTxt">Voeg een nieuw ticket toe...<br>
</a></td>
</tr>
<tr>
<th width="15%" class="StyleTxt">Naam</th>
<th width="15%" class="StyleTxt">Voornaam</th>
<th width="15%" class="StyleTxt">Partner achternaam</th>
<th width="15%" class="StyleTxt">Partner voornaam</th>
<th width="15%" class="StyleTxt">Herbalife-ID</th>
<th width="15%" class="StyleTxt">Upline</th>
</tr>
<?php
for($i=0; $i<$chkcount; $i++)
{
$id = $chk[$i];
$res=$MySQLiconn->query("SELECT user.FName, user.LName, user.HerbalifeID, user.UplineS, registratie.PartnerFName, registratie.PartnerLName, registratie.NaamVIP1, registratie.NaamVIP2, registratie.NaamVIP3, registratie.NaamVIP4, registratie.NaamVIP5, registratie.NaamVIP6, registratie.NaamVIP7, registratie.NaamVIP8, registratie.NaamVIP9, registratie.NaamVIP10, registratie.NaamVIP11, registratie.NaamVIP12 FROM registratie INNER JOIN user ON registratie.userID = user.UserID AND registratie.eventID=".$id);
while($row=$res->fetch_array())
{
?>
<tr>
<td style="background-color:gold;"><?php echo $row['FName'];?></td>
<td style="background-color:gold;"><?php echo $row['LName'];?></td>
<td style="background-color:gold;"><?php echo $row['PartnerFName'];?></td>
<td style="background-color:gold;"><?php echo $row['PartnerLName'];?></td>
<td style="background-color:gold;"><?php echo $row['HerbalifeID'];?></td>
<td style="background-color:gold;"><?php echo $row['UplineS'];?></td><br />
</tr>
<tr>
<td>VIP: <?php echo $row['NaamVIP1'];?></td>
<td>VIP: <?php echo $row['NaamVIP2'];?></td>
<td>VIP: <?php echo $row['NaamVIP3'];?></td>
<td>VIP: <?php echo $row['NaamVIP4'];?></td>
<td>VIP: <?php echo $row['NaamVIP5'];?></td>
<td>VIP: <?php echo $row['NaamVIP6'];?></td>
</tr>
<tr>
<td>VIP: <?php echo $row['NaamVIP7'];?></td>
<td>VIP: <?php echo $row['NaamVIP8'];?></td>
<td>VIP: <?php echo $row['NaamVIP9'];?></td>
<td>VIP: <?php echo $row['NaamVIP10'];?></td>
<td>VIP: <?php echo $row['NaamVIP11'];?></td>
<td>VIP: <?php echo $row['NaamVIP12'];?></td>
</tr>
<?php
}
}
?>
ACHTUNG: Sie haben eine [SQL-Injection] (http://stackoverflow.com/questions/60174/how -can-i-prevent-sql-injection-in-php) und möglicherweise auch einige XSS-Schwachstellen. –
Was soll das tun? 'If (isset ($ _ POST ['chk']) ==" ")'? – Mike