Well, I am making the eCommerce web application and I am trying to update the categories from the admin panel.
I have 2 pages (index.php and UpdateCategory.php) in categories folder which lies inside the admin folder in the root directory.
Now, I have come across the error of 503 - Intermittent service unavailable
whenever I click on the update button which is in the index.php
file. This happens only with the child category and not the parent category.
Here's the index.php file:
<?php
$table = '';
require_once '../../Classes/class.Validation.php';
$validate = new Validation();
$qu = "SELECT CatId, CatName FROM categories";
$validate->Query($qu);
if ($validate->NumRows()) {
while ( $row = $validate->FetchAllDatas() ) {
$table .= '<tr>';
$table .= '<td class="text-center">';
$table .= '<input type="checkbox" name="deleteCat[]" value='.$row["CatId"].'>';
$table .= '</td>';
$table .= '<td>';
$table .= $row["CatName"];
$table .= '</td>';
$table .= '<td>';
$table .= '<a href="//www.example.com/nbs/Administrators/Categories/UpdateCategory.php?id='.$row["CatId"].'">UPDATE</a>';
$table .= '</td>';
$table .= '<tr>';
}
}
echo $table;
?>
Whenever I click on the UPDATE link in the index.php file, UpdateCategory.php is requested. The browser responses with the page perfectly only for the parent category and does not responses to the child category. This error didn't occurred at all before adding .htaccess
file in the root directory and I had added .htaccess
file just few days back (maybe 3-4 days).
Here's the .htacccess
file
RewriteEngine On
RewriteRule ^product/([^/.]+)/?$ product.php?code=$1 [L]
RewriteRule ^beneficiary/([^/.]+)/?$ beneficiary.php?code=$1 [L]
RewriteRule ^categories/([^/.]+)/?$ categories.php?name=$1 [L]
RewriteRule ^category/([^/.]+)/?$ category.php?name=$1 [L]
The categories table have total 18 categories (inclusive of both parent and child)
I am also told to optimize the php code and also the queries. How do I optimize the php code and the mysqli queries ?
Kindly help me in solving this.
Any help is greatly appreciated.
Wi无法使用窗体并通过$ _POST获取值,并使用相同的查询在UpdateCategory.php中更新
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.