Answer the question
In order to leave comments, you need to log in
Why did data stop being written to the database after line 200?
The point is the following.
The page displays pickup points from the database (so far 208 items) in the form of a table-form.
On this page, you can change the field values arbitrarily (displayed as inputs) and there is a "Save" button.
Starting from the 200th pickup point and further, the data is not recorded in the database. Just refreshing the page.
Here is the code:
if ((isset($_REQUEST['point_id'][0])) && ($_REQUEST['point_id'][0]>0)) {
$sizearcount = sizeof($_REQUEST['point_id']);
for($i=0;$i<$sizearcount;$i++)
{
$this->db->query("UPDATE `" . DB_PREFIX . "pickup_point` SET point_iml = '" . $this->db->escape($_REQUEST['point_iml'][$i]) . "',
city_iml = '" . $this->db->escape($_REQUEST['city_iml'][$i]) . "' WHERE pickup_point_id = '" . (int)$_REQUEST['point_id'][$i] . "'");
}
}
// Выдача
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "pickup_point ORDER BY pickup_point_id");
$ords = $query->rows;
foreach ($ords as $result) {
$this->data['orders'][] = array(
'point_id' => $result['pickup_point_id'],
'point_name' => $result['point_name'],
'point_addres' => $result['point_address'],
'point_iml' => $result['point_iml'],
'city_iml' => $result['city_iml']
);
}
<div class="content">
<form action="" method="post" enctype="multipart/form-data" id="form">
<table class="list">
<thead>
<tr>
<td class="left">Название</td>
<td class="left">Адрес пункта</td>
<td class="left">IML код пункта самовывоза</td>
<td class="left">IML регион пункта самовывоза</td>
<td class="right"><?php echo $column_action; ?></td>
</tr>
</thead>
<tbody>
<?php if ($orders) { ?>
<?php foreach ($orders as $order) {
?>
<tr>
<td class="left">
<input type="hidden" name="point_id[]" value="<?php echo $order['point_id']; ?>">
<input type="text" name="point_name[]" value="<?php echo $order['point_name']; ?>">
</td>
<td class="left">
<input type="text" name="point_addres[]" value="<?php echo $order['point_addres']; ?>">
</td>
<td class="left">
<input type="text" name="point_iml[]" value="<?php echo $order['point_iml']; ?>" >
</td>
<td class="left">
<input type="text" name="city_iml[]" value="<?php echo $order['city_iml']; ?>">
</td>
<td class="right"><br>
<input type="submit" value="Сохранить">
</td>
</tr>
<?php } ?>
<?php } else { ?>
<tr>
<td class="center" colspan="8"><?php echo $text_no_results; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</form>
Answer the question
In order to leave comments, you need to log in
The exact reason is unknown to me, but there is a strong suspicion that the problem is related to the number of UPDATEs.
All changes can be made in one request. For this you can use, for example, the constructionINSERT INTO ... ON DUPLICATE KEY UPDATE
Try increasing the script execution time in the server settings.
And when printing in code, it is more convenient to use not your constructs in the code through curly braces, but through a colon:
<?php if ($orders) : ?>
<?php foreach ($orders as $order) : ?>
<?= $order['point_id']; ?>
<?php endforeach; ?>
<?php else : ?>
<?php endif; ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question