<?php require("connect.php"); ?>
<?php
if ($submit){
$opdracht = mysql_query("SELECT * FROM magazijn");
$aantalproducten = mysql_num_rows($opdracht);
echo "$aantalproducten";


for ($a=1; $a<$aantalproducten; $a++)
{
if (!get_magic_quotes_gpc())
{
$id$a = $_GET['id'] . $a;
$idoud$a = $_GET['idoud'] . $a;
$product$a = addslashes($_GET['product']) . $a;
$prijs$a = addslashes($_GET['prijs']) . $a;
$eenheid$a = addslashes($_GET['eenheid']) . $a;
}

else
{
$id$a = $_GET['id'] . $a;
$id$a = $_GET['oud'] . $a;
$product$a = $_GET['product'] . $a;
$prijs$a = $_GET['prijs'] . $a;
$eenheid$a = $_GET['eenheid'] . $a;
}



if (!empty($idoud$a) AND !empty($id$a) AND !empty($product$a) AND !empty($prijs$a) AND !empty($eenheid$a))
{
$updateoud = "UPDATE bbq_los SET id = '$id$a' , product = '$product$a' , prijs = '$prijs$a' , eenheid = '$eenheid$a' WHERE id = '$idoud$a'" or die (mysql_error());
mysql_query($updateoud) or die (mysql_error());
echo "de gegevens zijn succesvol veranderd";

}
}



}

else {

echo "
<html>

<head>


</head>

<body>

<div class=\"kopje\">$standaardbericht</div><br>
<form action=\"" .$_SERVER['PHPSELF'] . "\" METHOD=\"post\">
<table>\n";
$query = mysql_query("SELECT * FROM magazijn ORDER BY id") or die (mysql_error());

while ($var = mysql_fetch_array($query)) {

echo "\t\t\t\t <tr><td width=\"100\"><input type=\"tekst\" size=\"3\" name=\"idoud" .$var['id'] ."\" value=\"".$var['id'] ."\" READONLY><input type=\"text\" size=\"3\" name=\"id" .$var['id'] ."\" value=\"" .$var['id'] ."\"></td><td><input type=\"text\" size=\"50\" maxlength=\"50\" name=\"product" .$var['id'] ."\" value=\"" .$var['product'] . "\"></td><td><div class=\"bbq\">&euro;</div></td><td align=right><input type=\"text\" size=\"6\" maxlength=\"6\" name=\"prijs" .$var['id'] ."\" value=\"" .$var['prijs'] . "\"></td><td align=right><input type=\"text\" size=\"15\" maxlength=\"15\" name=\"eenheid" .$var['id'] ."\" value=\"" .$var['eenheid'] . "\"></td></tr>\n";

}

echo "

</table>
<input type=\"submit\" name=\"submit\">
</form>
</body>

</html>";
}

?>

Het probleem is dus om alle velden te updaten in de tabe maar hoe kan ik dit doen?

groet.
if ($submit){

En komt $submit vandaan? Klinkt als een probleem met superglobals.

Verder snap ik niet wat jouw probleem is, de opmerking
Het probleem is dus om alle velden te updaten in de tabe maar hoe kan ik dit doen?
doet mij vermoeden dat je nog niets hebt geprobeerd. Hopelijk heb ik het mis.
Dit is niet goed:
<?
$updateoud = "UPDATE bbq_los SET id = '$id$a' , product = '$product$a' , prijs = '$prijs$a' , eenheid = '$eenheid$a' WHERE id = '$idoud$a'" or die (mysql_error());
?>

Zo gaat ie goed:

<?
$updateoud = "UPDATE bbq_los SET id = '$id$a' , product = '$product$a' , prijs = '$prijs$a' , eenheid = '$eenheid$a' WHERE id = '$idoud$a'";
?>

Reageren