Mam problem z updatem wielu wierszy na raz. Wykorzystuje przykład z książki (w przykładzie jest usuwanie wpisów a ja nadpisuje może to jest problem). Może ktoś bardziej doświadczony coś złego zauważy. Z góry dziękuje za pomoc.
Po zapisaniu zmian pojawia się komunikat "Notice: Array to string conversion in C:\Program Files\EasyPHP-12.1\www\order_detail.php on line 16" i w polach tekstowych jest napisane ARRAY liczby zerują się także.
link do screen
http://i236.photobucket.com/albums/ff210/c...zpsfqnut6rc.png
http://i236.photobucket.com/albums/ff210/c...zpskjzt4wep.png
CODE
//aktualizacja szczegółów zleceń
if (isset($_POST['editall'])) {
foreach ($_POST['tochange'] as $expenditureid)
{
[16 linia] mysql_query("UPDATE expenditure SET et_name = '$_POST[et_name]', expenditure_price = '$_POST[expenditure_price]', expenditure_price_detal = '$_POST[expenditure_price_detal]', expenditure_type = '$_POST[expenditure_type]' WHERE expenditure_id = '$expenditureid'") or die(mysql_error());
}
echo '<h4>Poprawnie zaktualizowano szczegóły zlecenia.</h4>';
}
//tabelka
$query = "SELECT et_name, expenditure_price, expenditure_price_detal, expenditure_id, expenditure_type FROM `expenditure` WHERE order_id = $_POST[order_id] AND expenditure_type = 0";
$result = mysqli_query($link, $query);
echo'<tr class="results">';
while($rowgg = mysqli_fetch_array($result)) {
if ($rowgg['expenditure_price'] > $rowgg['expenditure_price_detal'])
{
$error = '<p>CENA DETALICZNA JEST NIŻSZA NIŻ ZAKUPU !</p><p>ZMIEŃ CENE !</p>';
}
else
{
$error = '';
}
echo '<td><input type="checkbox" value="'.$rowgg['expenditure_id'].'" name="tochange[]"/></td>
<td style="width: 500px"><input type="text" size="40" name="et_name[]" value="'.$rowgg['et_name'].'" /></td>
<td><input type="text" size="5" name="expenditure_price[]" value="'.$rowgg['expenditure_price'].'" /> zł</td>
<td> Detal: <input type="text" size="5" name="expenditure_price_detal[]" value="'.$rowgg['expenditure_price_detal'].'" /> '.$error.' zł</td>';
echo '<input type="hidden" name="expenditure_id[]" value="'.$rowgg['expenditure_id'].'" />
<td>
<select name="expenditure_type[]">
<option value=0>Część</option>
<option value=1>Usługa</option></select>
</td>';
echo '</tr>';
}
echo '</table>';
}
else {
echo '<b>Brak.</b>';
}
if (isset($_POST['editall'])) {
foreach ($_POST['tochange'] as $expenditureid)
{
[16 linia] mysql_query("UPDATE expenditure SET et_name = '$_POST[et_name]', expenditure_price = '$_POST[expenditure_price]', expenditure_price_detal = '$_POST[expenditure_price_detal]', expenditure_type = '$_POST[expenditure_type]' WHERE expenditure_id = '$expenditureid'") or die(mysql_error());
}
echo '<h4>Poprawnie zaktualizowano szczegóły zlecenia.</h4>';
}
//tabelka
$query = "SELECT et_name, expenditure_price, expenditure_price_detal, expenditure_id, expenditure_type FROM `expenditure` WHERE order_id = $_POST[order_id] AND expenditure_type = 0";
$result = mysqli_query($link, $query);
echo'<tr class="results">';
while($rowgg = mysqli_fetch_array($result)) {
if ($rowgg['expenditure_price'] > $rowgg['expenditure_price_detal'])
{
$error = '<p>CENA DETALICZNA JEST NIŻSZA NIŻ ZAKUPU !</p><p>ZMIEŃ CENE !</p>';
}
else
{
$error = '';
}
echo '<td><input type="checkbox" value="'.$rowgg['expenditure_id'].'" name="tochange[]"/></td>
<td style="width: 500px"><input type="text" size="40" name="et_name[]" value="'.$rowgg['et_name'].'" /></td>
<td><input type="text" size="5" name="expenditure_price[]" value="'.$rowgg['expenditure_price'].'" /> zł</td>
<td> Detal: <input type="text" size="5" name="expenditure_price_detal[]" value="'.$rowgg['expenditure_price_detal'].'" /> '.$error.' zł</td>';
echo '<input type="hidden" name="expenditure_id[]" value="'.$rowgg['expenditure_id'].'" />
<td>
<select name="expenditure_type[]">
<option value=0>Część</option>
<option value=1>Usługa</option></select>
</td>';
echo '</tr>';
}
echo '</table>';
}
else {
echo '<b>Brak.</b>';
}