PHP gevorderde |
|
<?php
if (isset($_POST['submit']) == 1) {
foreach($_POST['bigarray'] as $k => $v)
{
$sql = "UPDATE events SET Round='".$v."', distance='".$_POST['distance'][$k]."', start='".$_POST['start'][$k]."', Close='".$_POST['close'][$k]."', terrain='".$_POST['terrain'][$k]."' WHERE id = '".$k."'";
mysql_query($sql) or die("woops: '".$sql."'");
header("Location: index.php?nr=events");
}
}
else{
$sql = "SELECT * FROM `tacx` WHERE Round='".$round."' ORDER BY th,Tm,Ts ASC";
$result = mysql_query($sql) or die(mysql_error());
$num = mysql_num_rows($result);
while ($row = mysql_fetch_assoc($result))
{
$sql2 = "SELECT * FROM `gebruikers` WHERE id=".$row['id']."";
$result2 = mysql_query($sql2) or die(mysql_error());
$num = mysql_num_rows($result2);
while ($row2 = mysql_fetch_assoc($result2))
{
echo '<form method="post" action="'.$_SERVER['PHPSELF'].'">';
echo "<table width=\"550\" border=\"0\">";
echo "<tr>";
echo "<td vAlign=\"top\" width=\"229\"><input type=\"text\" name=\"bigarray[".$row['id']."]\" size=\"20\" value=\"".$row['Round']."\">";
echo "<li><input type=\"text\" name=\"start[".$row['id']."]\" size=\"20\" value=\"".$row['Ts']."\"></li>";
echo "<li><input type=\"text\" name=\"distance[".$row['id']."]\" size=\"20\" value=\"".$row2['naam']."\"></li>";
echo "<li><input type=\"text\" name=\"terrain[".$row['id']."]\" size=\"20\" value=\"".$row['Th']."\"></li>";
echo "<li><input type=\"text\" name=\"close[".$row['id']."]\" size=\"20\" value=\"".$row['Dd']."\"></li>";
echo "</td>";
echo "<td vAlign=\"top\" width=\"103\" height=\"100\"></td>";
echo "<td vAlign=\"top\" width=\"204\"></td>";
echo "</tr>";
echo "</table>";
echo "<hr>";
}
}
}
?>
<input type="submit" value="Updaten" name="submit">
</form>
<?php if (isset($_POST['submit']) == 1) { foreach($_POST['bigarray'] as $k => $v) { $sql = "UPDATE events SET Round='".$v."', distance='".$_POST['distance'][$k]."', start='".$_POST['start'][$k]."', Close='".$_POST['close'][$k]."', terrain='".$_POST['terrain'][$k]."' WHERE id = '".$k."'"; header("Location: index.php?nr=events"); } } else{ $sql = "SELECT * FROM `tacx` WHERE Round='".$round."' ORDER BY th,Tm,Ts ASC"; { $sql2 = "SELECT * FROM `gebruikers` WHERE id=".$row['id'].""; { echo '<form method="post" action="'.$_SERVER['PHPSELF'].'">'; echo "<table width=\"550\" border=\"0\">"; echo "<td vAlign=\"top\" width=\"229\"><input type=\"text\" name=\"bigarray[".$row['id']."]\" size=\"20\" value=\"".$row['Round']."\">"; echo "<li><input type=\"text\" name=\"start[".$row['id']."]\" size=\"20\" value=\"".$row['Ts']."\"></li>"; echo "<li><input type=\"text\" name=\"distance[".$row['id']."]\" size=\"20\" value=\"".$row2['naam']."\"></li>"; echo "<li><input type=\"text\" name=\"terrain[".$row['id']."]\" size=\"20\" value=\"".$row['Th']."\"></li>"; echo "<li><input type=\"text\" name=\"close[".$row['id']."]\" size=\"20\" value=\"".$row['Dd']."\"></li>"; echo "<td vAlign=\"top\" width=\"103\" height=\"100\"></td>"; echo "<td vAlign=\"top\" width=\"204\"></td>"; } } } ?> <input type="submit" value="Updaten" name="submit"> </form>
Zit er een fout in? de query's zijn goed en toch geeft hij niks weer...
|