Jump to content
lordspirit

Query de insert não devolve resultados

Recommended Posts

lordspirit

 

 

Bom dia e boa quarentena se for o vosso caso.

Ando a desenvolver um software de inventário a partir de uma app partilhada no github aqui. Tenho tudo a funcionar na BD desde inserção de múltiplas categorias ao filtro das mesmas através de dropdowns mas algo se passa na minha query para inserir os produtos. Já tentei algumas técnicas de debug mas sem solução e vim em busca da vossa ajuda.

Deixo o código.

 

products.php

<?php

	require_once '../database/database_connection.php';
	require_once 'helper.php';
	if(!isset($_SESSION['type']))
	{
		header("Location: ../login.php");
		die;
	}
	if($_SESSION['type']!='master')
	{
		header("Location : ../user");
		die;
	}
	require_once '../templates/header.php';
?>
	<section id="breadcrumb">
		<div class="container">
			<ol class="breadcrumb">
			  <li><a href="index.php">Dashboard</a></li>
			  <li class="active">Product</li>
			</ol>
		</div>
	</section>
	<div class="container">
		<span id="alert_action"></span>
		<div class="row">
			<div class="col-md-12">
				<div class="panel panel-default">
					<div class="panel-heading-pink">
						<h4 class="text-white">Product List</h4>
						<button type="button" class="btn btn-blue-grey" id="btnProductModal" data-toggle="modal" data-target="#productModal"><span class="glyphicon glyphicon-plus"></span> New Product</button>
					</div>
					<div class="panel-body">
						<div class="row">
							<div class="col-sm-12 table-responsive">
								<table id="product_data" class="table table-bordered table-striped">
									<thead>
										<tr>
											<th>Product ID</th>
											<th>Product Name</th>
											<th>Pais</th>
											<th>Localização</th>
											<th>SubLocalização</th>
											<th>Category</th>
											<th>Sub Category</th>
											<th>Brand</th>
											<th>Supplier</th>
											<th>Quantity</th>
											<th>Etiquetas</th>
											<th>Enter By</th>
											<th>Status</th>
											<th>Details</th>
											<th>Edit</th>
											<th>Delete</th>
										</tr>
									</thead>
								</table>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>


	<div class="modal fade" id="productModal">
	  <div class="modal-dialog">
	    <div class="modal-content">
	      <div class="modal-header">
	        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	        <h4 class="modal-title text-white"></h4>
	      </div>
	      <div class="modal-body">
	        <form method="post" id="productFormModal">
	        	<div class="form-group col-md-12">
	        		<label for="productName">Item / Modelo</label>
	        		<input type="text" class="form-control" name="productName" id="productName" placeholder="Item / Modelo" required>
	        	</div>
	        	<div class="form-group col-md-4">
	        		<label for="countryID">Pais</label>
	        		<select class="form-control" id="countryID" name="countryID" required>
								<option value="none" selected disabled hidden>
          				Pais
      					</option>

	        			<?php echo selectCountryList($conn); ?>
	        		</select>
	        	</div>
						<div class="form-group col-md-4">
	        		<label for="categoryID">Categoria</label>
	        		<select class="form-control" id="categoryID" name="categoryID">
								<option value="none" selected disabled hidden>
          				Categoria
      					</option>
	        			<?php echo selectCategoryList($conn); ?>
	        		</select>
	        	</div>
						<div class="form-group col-md-4">
							<label for="brandID">Marca</label>
							<select class="form-control" id="brandID" name="brandID">
								<option value="none" selected disabled hidden>
          				Marca
      					</option>
								<?php echo selectBrandList($conn); ?>
							</select>
						</div>
						<div class="form-group col-md-4">
							<label for="locationID">Localização</label>
							<select class="form-control" id="locationID" name="locationID">

							</select>
						</div>
						<div class="form-group col-md-4">
							<label for="subcategoryID">Sub Categoria</label>
							<select class="form-control" id="subcategoryID" name="subcategoryID">

								<!-- Sub category function -->
							</select>
						</div>
						<div class="form-group col-md-4">
							<label for="supplierID">Fornecedor</label>
							<select class="form-control" id="supplierID" name="supplierID" required>
								<option value="none" selected disabled hidden>
          				Fornecedor
      					</option>
								<?php echo selectSupplierList($conn); ?>
							</select>
						</div>
						<div class="form-group col-md-4">
							<label for="sublocationID">Sub Localização</label>
							<select class="form-control" id="sublocationID" name="sublocationID" required>

								<!-- Sublocation function -->
							</select>
						</div>
						<div class="form-group col-md-8">
		        	<label for="productQuantity">Quantidade</label>
		        	<div class="input-group">
				      <input type="number" class="form-control" id="productQuantity" placeholder="Quantidade" required>
				      <span class="input-group-addon">
				      	<select id="productUnit" name="productUnit" required>
		        			<option value="Unit">Unidades</option>
		        			<option value="Mts">Metros</option>
		        			<option value="Box">Bobine</option>
		        		</select>
				      </span>
				    </div>
		        </div>
	        	<div class="form-group col-md-12">
	        		<label for="productDescription">Observações</label>
	        		<textarea class="form-control" rows="3" name="productDescription" id="productDescription" placeholder="Observações"></textarea>
	        	</div>
		        <div class="form-group col-md-6">
	        		<label for="ipaddress">Endereço IP</label>
	        		<div class="input-group">
	        			<span class="input-group-addon">IP </span>
	        			<input type="text" class="form-control" id="ipaddress">
	        		</div>
	        	</div>
	        	<div class="form-group col-md-6">
	        		<label for="serialnumber">Número de Serie</label>
	        		<div class="input-group">
	        			<span class="input-group-addon">Serial</span>
	        			 <input type="text" class="form-control" id="serialnumber">
	        		</div>

	        	</div>
						<div class="form-group col-md-4">
	        		<label for="label1">Etiqueta 1</label>
	        		<select class="form-control" id="label1" name="label1" required>
								<option value="none" selected disabled hidden>
          				Etiqueta 1
      					</option>
	        			<?php echo selectLabelList($conn); ?>
	        		</select>
	        	</div>
						<div class="form-group col-md-4">
	        		<label for="label2">Etiqueta 2</label>
	        		<select class="form-control" id="label2" name="label2" required>
								<option value="none" selected disabled hidden>
									Etiqueta 2
								</option>
	        			<?php echo selectLabelList($conn); ?>
	        		</select>
	        	</div>
						<div class="form-group col-md-4">
	        		<label for="label3">Etiqueta 3</label>
	        		<select class="form-control" id="label3" name="label3" required>
								<option value="none" selected disabled hidden>
									Etiqueta 3
								</option>
	        			<?php echo selectLabelList($conn); ?>
	        		</select>
	        	</div>
	      </div>
	      <div class="modal-footer">
	        <button type="button" class="btn btn-dark" data-dismiss="modal">Cancel</button>
	        <input type="submit" id="productBtnModal" class="btn btn-pink text-white" value="">
	      </div>
	      </form>
	    </div>
	  </div>
	</div>

	<!-- Modal View -->
	<div class="modal fade" id="viewProductModal" tabindex="-1" role="dialog" aria-labelledby="viewProductModalLabel">
	  <div class="modal-dialog">
	    <div class="modal-content">
	      <div class="modal-header bg-lightblue">
	        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	        <h4 class="modal-title text-white">Product Details</h4>
	      </div>
	      <div class="modal-body">

	      </div>
	      <div class="modal-footer">
	        <button type="button" class="btn btn-dark" data-dismiss="modal">Close</button>
	      </div>
	    </div>
	  </div>
	</div>

	<div id="deleteProductModal" class="modal fade">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header bg-red">
					<button type="button" style="color: #fff;" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title text-white"><span class="glyphicon glyphicon-trash"></span> Delete Product</h4>
				</div>
				<div class="modal-body">

				</div>
				<div class="modal-footer">
			        <button type="button" class="btn btn-dark" data-dismiss="modal">Cancel</button>
			        <input type="submit" class="btn btn-danger" id="deleteProductBtn" value="Delete Product">
			     </div>
			</div>
		</div>
	</div>
	<script type="text/javascript">
		$(document).ready(function(){
			const productListInfo = $('#product_data').DataTable({
				dom: '<"top"Bif>rt<"bottom"lp><"clear">',
				buttons: [ 'copy', 'print', 'excel', 'pdf', 'colvis' ],
				"processing": true,
				"serverSide": true,
				"order" : [],
				"ajax" : {
					url : 'products_fetch.php',
					type : 'POST'
				},
				"pageLength" : 10,
				"columns":[
					{"name" : "productID", "orderable":true},
					{"name" : "productName", "orderable":true},
					{"name" : "countryName", "orderable":true},
					{"name" : "locationName", "orderable":true},
					{"name" : "sublocationName", "orderable":true},
					{"name" : "categoryName", "orderable":true},
					{"name" : "subcategoryName", "orderable":true},
					{"name" : "brandName", "orderable":true},
					{"name" : "supplierName", "orderable":true},
					{"name" : "productQuantity", "orderable":true},
					{"name" : "productUnit", "orderable":false},
					{"name" : "productDescription", "orderable":true},
					{"name" : "ipAddress", "orderable":true},
					{"name" : "serialNumber", "orderable":true},
					{"name" : "label1", "orderable":true},
					{"name" : "label2", "orderable":true},
					{"name" : "label3", "orderable":true},
					{"name" : "userName", "orderable":true},
					{"name" : "productStatus", "orderable":true},
					{"name" : "Edit", "orderable":false},
					{"name" : "View", "orderable":false},
					{"name" : "Delete", "orderable":false}
				]
			});
				let hasSelectChange = false;
				let addProductToken = '';
				let updateProductToken = '';
				let deleteProductToken = '';
			$(document).on('click','#btnProductModal', function(){
				updateProductToken = '<?php echo hash('sha256', 'abcdef')  ?>';
				deleteProductToken = "<?php echo hash('sha256', '12345')  ?>";
				addProductToken = "<?php echo hash('sha256', 'add_product_token')  ?>";
				$('#productModal .modal-body div').remove('.checkbox');
				$('#productFormModal')[0].reset();
				$('#productModal .modal-header').removeClass('bg-orange');
				$('#productModal .modal-header').removeClass('bg-red');
				$('#productModal .modal-header').addClass('bg-pink');
				$('#productModal .modal-title').html('<span class="glyphicon glyphicon-plus"></span> Add New Product');
				$('#productBtnModal').removeClass('deleteProductSubmit');
				$('#productBtnModal').removeClass('btn-warning updateProductSubmit');
				$('#productBtnModal').addClass('btn-pink text-white addProductSubmit');
				$('#productBtnModal').val('Add New Product');
				$('#productBtnModal').removeAttr('update_product_id');
				$('#productBtnModal').removeAttr('delete_product_id');
				$('#productBtnModal').removeAttr('delete_product_name');
				$('#productUnit option').remove('#selectedValue');
				$('#productUnit option').remove('#disabledSelected');
				$('#productUnit').prepend(`<option value="" id="disabledSelected"  disabled selected>Unidade</option>`);
				//opçoes caixa categoria
				$('#categoryID option').remove('#categorySelectedValue');
				$('#categoryID option').remove('#categoryDisabledSelected');
				$('#categoryID').prepend(`<option  disabled selected id="categoryDisabledSelected">Categoria</option>`);
				//opçoes caixa pais
				$('#countryID option').remove('#countrySelectedValue');
				$('#countryID option').remove('#countryDisabledSelected');
				$('#countryID').prepend(`<option  disabled selected id="countryDisabledSelected">Pais</option>`);
				//opçoes caixa localização
				$('#locationID option').remove('#locationSelectedValue');
				$('#locationID option').remove('#locationDisabledSelected');
				$('#locationID').prepend(`<option  disabled selected id="locationDisabledSelected">Localização</option>`);
				//opçoes caixa sublocalização
				$('#sublocationID option').remove('#sublocationSelectedValue');
				$('#sublocationID option').remove('#sublocationDisabledSelected');
				$('#sublocationID').prepend(`<option  disabled selected id="sublocationDisabledSelected">Sub Localização</option>`);
				//opçoes caixa subcategoria
				$('#subcategoryID option').remove('#subcategorySelectedValue');
				$('#subcategoryID option').remove('#subcategoryDisabledSelected');
				$('#subcategoryID').prepend(`<option  disabled selected id="subcategoryDisabledSelected">Sub Categoria</option>`);
				//opçoes caixa marca
				$('#brandID option').remove('#brandSelectedValue');
				$('#brandID option').remove('#brandDisabledSelected');
				$('#brandID').prepend(`<option  disabled selected id="brandDisabledSelected">Marca</option>`);
				//opçoes caixa fornecedor
				$('#supplierID option').remove('#supplierSelectedValue');
				$('#supplierID option').remove('#supplierDisabledSelected');
				$('#supplierID').prepend(`<option  disabled selected id="supplierDisabledSelected">Fornecedor</option>`);
				//opçoes caixa etiqueta 1
				$('#label1 option').remove('#label1SelectedValue');
				$('#label1 option').remove('#label1DisabledSelected');
				$('#label1').prepend(`<option  disabled selected id="label1DisabledSelected">Etiqueta 1</option>`);
				//opçoes caixa etiqueta 2
				$('#label2 option').remove('#label2SelectedValue');
				$('#label2 option').remove('#label2DisabledSelected');
				$('#label2').prepend(`<option  disabled selected id="label2DisabledSelected">Etiqueta 2</option>`);
				//opçoes caixa etiqueta 3
				$('#label3 option').remove('#label3SelectedValue');
				$('#label3 option').remove('#label3DisabledSelected');
				$('#label3').prepend(`<option  disabled selected id="label3DisabledSelected">Etiqueta 3</option>`);
				$('#brandList').html('');
			});
			//*********************** perceber funcionalidade *****************************
			$(document).on('change', '#categoryID', function(){
				hasSelectChange = true;
				const categoryID = $('#categoryID').val();
				$.ajax({
					url : 'products_manage.php',
					method : 'POST',
					data : {'categoryID' : categoryID, 'hasSelectChange' : hasSelectChange},
					success:function(data){
						$('#brandList').html(data);
					}
				});
			});
			//***************************************************************************
			$(document).on('click', '.addProductSubmit', function(event){
				event.preventDefault();
				$(this).attr('disabled', 'disabled');
				const addProductFormData = [
											{name : 'addProductToken', value : addProductToken},
											{name : 'productName', value : $('#productName').val()},
											{name : 'countryID', value : $('#countryID').val()},
											{name : 'locationID', value : $('#locationID').val()},
											{name : 'sublocationID', value : $('#sublocationID').val()},
											{name : 'categoryID', value : $('#categoryID').val()},
											{name : 'subcategoryID', value : $('#subcategoryID').val()},
											{name : 'brandID', value : $('#brandID').val()},
											{name : 'supplierID', value : $('#supplierID').val()},
											{name : 'productQuantity', value : $('#productQuantity').val()},
											{name : 'productUnit', value : $('#productUnit').val()},
											{name : 'productDescription', value : $('#productDescription').val()},
											{name : 'ipaddress', value : $('#ipaddress').val()},
											{name : 'serialnumber', value : $('#serialnumber').val()},
											{name : 'label1', value : $('#label1').val()},
											{name : 'label2', value : $('#label2').val()},
											{name : 'label3', value : $('#label3').val()},
										 ];
				$.ajax({
					url : 'products_manage.php',
					method : 'POST',
					data : addProductFormData,
					success:function(data){
						$('#productFormModal')[0].reset();
						$('#productModal').modal('hide');
						$('#alert_action').fadeIn().html(`<div class="alert alert-info">
							  <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
							  <strong>`+ data +`</strong>
							</div>`);
						$('#productBtnModal').attr('disabled', false);
						productListInfo.ajax.reload();
					}
				});
			});
			$(document).on('click', '.viewProduct', function(){
				const productViewID = $(this).attr('id');
				const productViewName = $(this).attr('productViewName');
				const productViewCountry = $(this).attr('productViewCountry');
				const productViewLocation = $(this).attr('productViewLocation');
				const productViewSublocation = $(this).attr('productViewSublocation');
				const productViewCategory = $(this).attr('productViewCategory');
				const productViewSubcategory = $(this).attr('productViewSubcategory');
				const productViewBrand = $(this).attr('productViewBrand');
				const productViewSupplier = $(this).attr('productViewSupplier');
				const productViewQuantity = $(this).attr('productViewQuantity');
				const productViewDescription = $(this).attr('productViewDescription');
				const productViewIpAddress = $(this).attr('productViewIpAddress');
				const productViewSerialNumber = $(this).attr('productViewSerialNumber');
				const productViewLabel1 = $(this).attr('productViewLabel1');
				const productViewLabel2 = $(this).attr('productViewLabel2');
				const productViewLabel3 = $(this).attr('productViewLabel3');
				const productViewEnterBy = $(this).attr('productViewEnterBy');
				const productViewStatus = $(this).attr('productViewStatus');


				console.log(productViewBasePrice);
				let statusTag = '';
				let productDescriptionTag = ''
				if(productViewDescription==''){
					productDescriptionTag = '<td> - </td>'
				}else{
					productDescriptionTag = '<td>'+productViewDescription+'</td>'
				}
				if(productViewStatus=='active'){
					statusTag = '<td class="text-success" >Activo</td>'
				}else
				{
					statusTag = '<td class="text-danger" >Inactivo</td>'
				}
				$('#viewProductModal .modal-body').html(`
													<table class="table table-striped">
														<tr>
												      		<td>Product ID</td>
												      		<td>`+productViewID+`</td>
												      	</tr>
												      	 <tr>
												      		<td>Product Name</td>
												      		<td>`+productViewName+`</td>
												      	</tr>
																<tr>
																 <td>Product Country</td>
																 <td>`+productViewCountry+`</td>
															 </tr>
												      	<tr>
												      		<td>Description</td>
												      		`+productViewLocation+`
												      	</tr>
												      	<tr>
												      		<td>Brand</td>
												      		<td>`+productViewSublocation+`</td>
												      	</tr>
												      	<tr>
												      		<td>Category</td>
												      		<td>`+productViewCategory+`</td>
												      	</tr>
												      	<tr>
												      		<td>Product Quantity</td>
												      		<td>`+productViewSubcategory+`</td>
												      	</tr>
												      	<tr>
												      		<td>Enter By</td>
												      		 <td>`+productViewBrand+`</td>
												      	</tr>
																<tr>
												      		<td>Enter By</td>
												      		 <td>`+productViewSupplier+`</td>
												      	</tr>
																<tr>
												      		<td>Enter By</td>
												      		 <td>`+productViewQuantity+`</td>
												      	</tr>
																<tr>
												      		<td>Enter By</td>
												      		 <td>`+productViewLabels+`</td>
												      	</tr>
																<tr>
												      		<td>Enter By</td>
												      		 <td>`+productViewEnterBy+`</td>
												      	</tr>
																<tr>
																	<td>Enter By</td>
																	 <td>`+productViewStatus+`</td>
																</tr>
																<tr>
																	<td>Enter By</td>
																	 <td>`+productViewDescription+`</td>
																</tr>
												      	<tr>
												      		<td>Product Status</td>
												      		`+statusTag+`
												      	</tr>
												      </table>`);
			});
			$(document).on('click', '.editProduct', function(){
				addProductToken = "<?php echo hash('sha256', 'asdfgh')  ?>";
				deleteProductToken = "<?php echo hash('sha256', '12345')  ?>";
				updateProductToken = '<?php echo hash('sha256', 'update_product_token')  ?>';
				$('#productFormModal')[0].reset();
				$('#productModal .modal-header').removeClass('bg-pink');
				$('#productModal .modal-header').removeClass('bg-red');
				$('#productModal .modal-header').addClass('bg-orange');
				$('#productModal .modal-title').html('<span class="glyphicon glyphicon-plus"></span>Edit Product');
				$('#productBtnModal').removeClass('deleteProductSubmit');
				$('#productBtnModal').addClass('btn-warning updateProductSubmit');
				$('#productBtnModal').removeClass('btn-pink text-white addProductSubmit');
				$('#productBtnModal').val('Edit Product');
				$('#productBtnModal').removeAttr('delete_product_id');
				$('#productBtnModal').removeAttr('delete_product_name');
				const productEditID = $(this).attr('id');
				const productEditName = $(this).attr('productEditName');
				const productEditDescription = $(this).attr('productEditDescription');
				const productEditBrand = $(this).attr('productEditBrand');
				const productEditCategory = $(this).attr('productEditCategory');
				const productEditQuantity = $(this).attr('productEditQuantity');
				const productEditBasePrice = $(this).attr('productEditBasePrice');
				const productEditTax = $(this).attr('productEditTax');
				const productEditEnterBy = $(this).attr('productEditEnterBy');
				const productEditStatus = $(this).attr('productEditStatus');
				const productEditBrandID = $(this).attr('productEditBrandID');
				const productEditCategoryID = $(this).attr('productEditCategoryID');
				const productEditUnit = $(this).attr('productEditUnit');
				$('#productBtnModal').attr('update_product_id', productEditID);
				$('#productModal').modal('show');
				$('#productName').val(productEditName);
				$('#categoryID option').remove('#categorySelectedValue');
				$('#categoryID option').remove('#categoryDisabledSelected');
				$('#categoryID').prepend(`<option value="`+productEditCategoryID+`" id="categorySelectedValue" selected>`+productEditCategory+`</option>`);

				$('#productDescription').val(productEditDescription);
				$('#productQuantity').val(productEditQuantity);
				$('#productUnit option').remove('#selectedValue');
				$('#productUnit option').remove('#disabledSelected');
				$('#productUnit').prepend(`<option value="`+productEditUnit+`" id="selectedValue" selected>`+productEditUnit+`</option>`);
				let checkboxElems = '';
				if(productEditStatus== 'active'){
					 checkboxElems = `<label id="labelStatusProduct">
										<input type="checkbox" id="checkboxStatusProduct" checked> Activo
									  </label>`;
				}
				else{
					 checkboxElems = `<label id="labelStatusProduct">
										<input type="checkbox" id="checkboxStatusProduct" > Inactivo
									  </label>`;
				}
				$('#productModal .modal-body div').remove('.checkbox');
				$('#productModal .modal-body').append(`<div class="checkbox">
														`+ checkboxElems +`
														</div>`);
			});
			$(document).on('click', '#checkboxStatusProduct', function(){
				let str = $("#labelStatusProduct").text();
				let str2 = str.trim();
				if(str2=='Activo'){
					$("#labelStatusProduct").html(`<input type="checkbox" id="checkboxStatusProduct" > Inactivo`);
				}
				else{
					$("#labelStatusProduct").html(`<input type="checkbox" id="checkboxStatusProduct" checked > Activo`);
				}
			});
			$(document).on('click','.updateProductSubmit', function(event){
				event.preventDefault();
				$(this).attr('disabled', 'disabled');
				let str = $("#labelStatusProduct").text();
				let str2 = str.trim();
				let updateProductStatus = str2.toLowerCase();
				const editProductFormData = [
												{name : 'updateProductToken', value : updateProductToken},
												{name : 'productID', value : $(this).attr('update_product_id')},
												{name : 'productName', value : $('#productName').val()},
												{name : 'countryID', value : $('#countryID').val()},
												{name : 'locationID', value : $('#locationID').val()},
												{name : 'sublocationID', value : $('#sublocationID').val()},
												{name : 'categoryID', value : $('#categoryID').val()},
												{name : 'subcategoryID', value : $('#subcategoryID').val()},
												{name : 'brandID', value : $('#brandID').val()},
												{name : 'supplierID', value : $('#supplierID').val()},
												{name : 'productQuantity', value : $('#productQuantity').val()},
												{name : 'productUnit', value : $('#productUnit').val()},
												{name : 'productDescription', value : $('#productDescription').val()},
												{name : 'ipAddress', value : $('#ipAddress').val()},
												{name : 'serialNumber', value : $('#serialNumber').val()},
												{name : 'label1', value : $('#label1').val()},
												{name : 'label2', value : $('#label2').val()},
												{name : 'label3', value : $('#label3').val()},
												{name : 'productStatus', value : updateProductStatus}
											];
				$.ajax({
					url : 'products_manage.php',
					method : 'POST',
					data : editProductFormData,
					success:function(data){
						$('#productFormModal')[0].reset();
						$('#productModal').modal('hide');
						$('#alert_action').fadeIn().html(`<div class="alert alert-warning">
							  <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
							  <strong>`+ data +`</strong>
							</div>`);
						$('#productBtnModal').attr('disabled', false);
						productListInfo.ajax.reload();
					}
				});
			});
			$(document).on('click', '.deleteProduct', function(){
				addProductToken = "<?php echo hash('sha256', 'asdfgh')  ?>";
				deleteProductToken = "<?php echo hash('sha256', 'delete_product_token')  ?>";
				updateProductToken = '<?php echo hash('sha256', 'abcdef')  ?>';
				$('#productBtnModal').removeClass('btn-warning updateProductSubmit');
				$('#productBtnModal').removeClass('btn-pink text-white addProductSubmit');
				$('#deleteProductBtn').removeAttr('update_product_id');
				$('#deleteProductBtn').attr('delete_product_id', $(this).attr('id'));
				$('#deleteProductBtn').attr('delete_product_name', $(this).attr('productName'));
				$('#deleteProductBtn').addClass('deleteProductSubmit');
				$('#deleteProductModal .modal-body').html(`<h5 class="text-black"> Are You Sure Want to Permanently Delete  <strong>"`+ $(this).attr('productName') +`"</strong> Product ?</h5>`)
			});
			$(document).on('click','.deleteProductSubmit', function(event){
				event.preventDefault();
				$('#deleteProductBtn').attr('disabled', 'disabled');
				deleteProductSubmit = true;
				const deleteProductFormData = [
												{name : 'deleteProductToken', value : deleteProductToken},
												{name : 'productID', value : $(this).attr('delete_product_id')},
												{name : 'productName', value : $(this).attr('delete_product_name')}
											  ];
				$.ajax({
					url : 'products_manage.php',
					method : 'POST',
					data : deleteProductFormData,
					success:function(data){
						$('#deleteProductModal').modal('hide');
						$('#alert_action').fadeIn().html(`<div class="alert alert-danger">
							  <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
							  <strong>`+ data +`</strong>
							</div>`);
						$('#deleteProductBtn').attr('disabled', false);
						productListInfo.ajax.reload();
					}
				})
			});
		});

		$("#countryID").change(function(){
					var deptid = $('#countryID').find(":selected").val();

					$.ajax({
							url: 'get_locations.php',
							type: 'post',
							data: {country:deptid},
							success:function(response){
								$('#locationID').empty()
								.append('<option value="" id="disabledSelected" disabled="" selected="">Select Location</option>')
								.append(response);
							}
					});
			});

			$("#locationID").change(function(){
						var deptid = $('#locationID').find(":selected").val();

						$.ajax({
								url: 'get_sublocations.php',
								type: 'post',
								data: {location:deptid},
								success:function(response){
									$('#sublocationID').empty()
									.append('<option value="" id="disabledSelected" disabled="" selected="">Sub Localização</option>')
									.append(response);
								}
						});
				});

				$("#categoryID").change(function(){
							var deptid = $('#categoryID').find(":selected").val();

							$.ajax({
									url: 'get_subcategories.php',
									type: 'post',
									data: {category:deptid},
									success:function(response){
										$('#subcategoryID').empty()
										.append('<option value="" id="disabledSelected" disabled="" selected="">Sub Categoria</option>')
										.append(response);
									}
							});
					});

	</script>
<?php require_once '../templates/footer.php'; ?>

products_manage.php

<?php
	require_once '../database/database_connection.php';
	require_once 'helper.php';
	if(!isset($_SESSION['type']))
	{
		header("Location: ../login.php");
		die;
	}
	if($_SESSION['type']!='master')
	{
		header("Location : ../user");
		die;
	}
// 	if(isset($_POST['hasSelectChange']))
// {
// if($_POST['hasSelectChange']==true)
// {
// 	echo selectProductList($conn, $_POST['categoryID']) ;
// }
// }
if(isset($_POST['addProductToken']))
{
$token = hash('sha256', 'add_product_token');
if($_POST['addProductToken']===$token)
{
	if(htmlspecialchars($_POST['productName']!='') && htmlspecialchars($_POST['productQuantity']!='') && htmlspecialchars($_POST['productUnit']!=''))
	{
		if(is_numeric(htmlspecialchars($_POST['productQuantity'])) && !is_numeric(htmlspecialchars($_POST['productName'])))
		{
			$query = "INSERT INTO products (productName, countryID, locationID, sublocationID, , categoryID, subcategoryID, brandID, supplierID, productQuantity, productUnit, productDescription, ipAddress, serialNumber, label1, label2, label3, productEnterBy, productStatus, productDate)
VALUES(:productName, :countryID, :locationID, :sublocationID, :categoryID, :subcategoryID, :brandID, :supplierID, :productQuantity, :productUnit, :productDescription, :ipAddress, :serialNumber, :label1, :label2, :label3, :productEnterBy, :productStatus, :productDate)";
			$stmt = $conn->prepare($query);
			$stmt->execute([
								':productName' => htmlspecialchars($_POST['productName']),
								':countryID' => htmlspecialchars($_POST['countryID']),
								':locationID' => htmlspecialchars($_POST['locationID']),
								':sublocationID' => htmlspecialchars($_POST['sublocationID']),
								':categoryID' => htmlspecialchars($_POST['categoryID']),
								':subcategoryID' => htmlspecialchars($_POST['subcategoryID']),
								':brandID' => htmlspecialchars($_POST['brandID']),
								':supplierID' => htmlspecialchars($_POST['supplierID']),
								':productQuantity' => htmlspecialchars($_POST['productQuantity']),
								':productUnit' => htmlspecialchars($_POST['productUnit']),
								':productDescription' => htmlspecialchars($_POST['productDescription']),
								':ipAddress' => htmlspecialchars($_POST['ipAddress']),
								':serialNumber' => htmlspecialchars($_POST['serialNumber']),
								':label1' => htmlspecialchars($_POST['label1']),
								':label2' => htmlspecialchars($_POST['label2']),
								':label3' => htmlspecialchars($_POST['label3']),
								':productEnterBy' => $_SESSION['userID'],
								':productStatus' => 'active',
								':productDate' => date('Y-m-d')
							 ]);
					$result = $stmt->rowCount();

					if($result > 0)
					{
						echo "New Product Added!";
					}
					else
					{
						die('Failed to execute! an error occured.');
					}
				}
				else
				{
					die('Product Name can not filled by numeric or Product Quantity, must be filled by numeric.');
				}

			}
			else
			{
				die('Please fill Product Name, Product Quantity and Product Unit Field.');
			}
		}
		else
		{
			die('Failed to execute! an error occured.');
		}

	}
	if(isset($_POST['updateProductToken']))
	{
		$token = hash('sha256', 'update_product_token');
		if($_POST['updateProductToken']===$token)
		{
			if(htmlspecialchars($_POST['brandID'])!='' && htmlspecialchars($_POST['categoryID']!='') && htmlspecialchars($_POST['productName']!='') && htmlspecialchars($_POST['productQuantity']!='') && htmlspecialchars($_POST['productBasePrice']!='') && htmlspecialchars($_POST['productTax']!='') && htmlspecialchars($_POST['productUnit']!=''))
			{
				if(is_numeric(htmlspecialchars($_POST['productBasePrice'])) && is_numeric(htmlspecialchars($_POST['productTax'])) && is_numeric(htmlspecialchars($_POST['productQuantity'])) && !is_numeric(htmlspecialchars($_POST['productName'])))
				{
					$query = "UPDATE product SET categoryID = :categoryID, brandID = :brandID, productName = :productName, productDescription = :productDescription, productBasePrice = :productBasePrice, productQuantity = :productQuantity, productUnit = :productUnit, productTax = :productTax , productStatus = :productStatus WHERE productID = :productID";
					$stmt = $conn->prepare($query);
					$stmt->execute([
										':categoryID' => htmlspecialchars($_POST['categoryID']),
										':brandID' => htmlspecialchars($_POST['brandID']),
										':productName' => htmlspecialchars($_POST['productName']),
										':productDescription' => htmlspecialchars($_POST['productDescription']),
										':productBasePrice' => htmlspecialchars(preg_replace('/[^0-9]/', '', $_POST['productBasePrice'])),
										':productQuantity' => htmlspecialchars($_POST['productQuantity']),
										':productUnit' => htmlspecialchars($_POST['productUnit']),
										':productTax' => htmlspecialchars(preg_replace('/[^0-9]/', '', $_POST['productTax'])),
										':productStatus' => htmlspecialchars($_POST['productStatus']),
										':productID' => htmlspecialchars($_POST['productID'])
								   ]);
					$result = $stmt->rowCount();
					if($result > 0)
					{
						echo "Product Edited";
					}
					else
					{
						die('Failed to edit product An error occured.');
					}
				}
				else
				{
					die('Product Name can not filled by numeric or Product Quantity, Product Base Price, Product Quantity, and Product Tax must filled by numeric.');
				}
			}
			else
			{
				die('Please fill Product Name, Product Quantity, Product Base Price, Product Tax, and Product Unit Field.');
			}

		}
		else
		{
			die('Failed to execute! an error occured.');
		}
	}
	if(isset($_POST['deleteProductToken']))
	{
		$token = hash('sha256', 'delete_product_token');
		if($_POST['deleteProductToken']===$token)
		{
			$query = "DELETE FROM product WHERE productID = :productID";
			$stmt = $conn->prepare($query);
			$stmt->execute([':productID' => htmlspecialchars($_POST['productID'])]);
			$result = $stmt->rowCount();
			if($result > 0)
			{
				echo $_POST['productName']." has been deleted!";
			}
			else
			{
				die('Failed to execute! an error occured.');
			}
		}
		else
		{
			die('Failed to execute! an error occured.');
		}
	}

products_fetch.php

<?php
require_once '../database/database_connection.php';
if(!isset($_SESSION['type']))
{
	header("Location: ../login.php");
	die;
}
if($_SESSION['type']!='master')
{
	header("Location : ../user");
	die;
}
$query = '';
$output = [];
$query .= "Select * From product";
if(isset($_POST['search']['value']))
{
	if($_POST['search']['value'] != '')
	{
		$query .= 'WHERE product.productID LIKE "%'. $_POST["search"]["value"] .'%" ';
		$query .= 'OR product.productName LIKE "%'. $_POST["search"]["value"] .'%" ';
		$query .= 'OR category.categoryName LIKE "%'. $_POST["search"]["value"] .'%" ';
		$query .= 'OR brand.brandName LIKE "%'. $_POST["search"]["value"] .'%" ';
		$query .= 'OR user.userName LIKE "%'. $_POST["search"]["value"] .'%" ';
		$query .= 'OR product.productQuantity LIKE "%'. $_POST["search"]["value"] .'%" ';
		$query .= 'OR product.productStatus LIKE "%'. $_POST["search"]["value"] .'%" ';
	}
}
if(isset($_POST["order"]))
{
	$tes =  $_POST['order'][0]["column"];
	$query .= ' ORDER BY '.$_POST["columns"][$tes]["name"].' '.$_POST["order"]["0"]["dir"].'';

}
else
{
	$query .= "ORDER BY productID DESC";
}
if(isset($_POST['length']))
{
	if($_POST["length"] != -1)
	{
		$query .= ' LIMIT '. $_POST['start'].', '. $_POST['length'];
	}
}
$stmt = $conn->prepare($query);
$stmt->execute();
$result = $stmt->fetchAll();
$data = [];
$filtered_rows = $stmt->rowCount();
foreach($result as $row)
{
	$status = '';
	if($row['productStatus']=='active')
	{
		$status = '<p class="text-success">Active</p>';
	}
	else
	{
		$status = '<p class="text-danger">Inactive</p>';
	}
	$sub_array = [];
	$sub_array[] = $row['productID'];
	$sub_array[] = $row['productName'];
	$sub_array[] = $row['categoryName'];
	$sub_array[] = $row['brandName'];
	$sub_array[] = $row['productQuantity'].' '.$row['productUnit'];
	$sub_array[] = $row['userName'];
	$sub_array[] = $status;
	$sub_array[] =  '<button type="button" id="'.$row["productID"].'" class ="btn btn-info btn-xs viewProduct" productViewName="'.$row["productName"].'" productViewBrand="'.$row["brandName"].'" productViewCategory="'.$row["categoryName"].'" productViewBasePrice="'.$row["productBasePrice"].'" productViewQuantity="'.$row["productQuantity"].'" productViewTax="'.$row["productTax"].'" productViewEnterBy="'.$row["userName"].'" productViewStatus="'.$row["productStatus"].'" productViewDescription="'.$row["productDescription"].'" data-toggle="modal" data-target="#viewProductModal"  >View</button>';
	$sub_array[] =  '<button type="button" id="'.$row["productID"].'" class ="btn btn-warning btn-xs editProduct" productEditName="'.$row["productName"].'" productEditBrand="'.$row["brandName"].'" productEditCategory="'.$row["categoryName"].'" productEditBasePrice="'.$row["productBasePrice"].'" productEditQuantity="'.$row["productQuantity"].'" productEditTax="'.$row["productTax"].'" productEditEnterBy="'.$row["userName"].'" productEditStatus="'.$row["productStatus"].'" productEditDescription="'.$row["productDescription"].'" productEditCategoryID="'.$row["categoryID"].'" productEditBrandID="'.$row["brandID"].'" productEditUnit="'.$row["productUnit"].'">Edit</button>';
	$sub_array[] = '<button type="button" id="'.$row["productID"].'" class ="btn btn-danger btn-xs deleteProduct" productName="'.$row["productName"].'" data-toggle="modal" data-target="#deleteProductModal">Delete</button>';
	$data[] = $sub_array;
}
$draw = '';
if(isset($_POST['draw']))
{
	$draw = $_POST['draw'];
}
$output = [
			"draw" => intval($draw),
			"recordsTotal" => $filtered_rows,
			"recordsFiltered" => getTotalAllRecords($conn),
			"data" => $data
		];

echo json_encode($output);
function getTotalAllRecords($conn)
{
	$stmnt = $conn->prepare("SELECT * FROM product ");
	$stmnt->execute();
	return $stmnt->rowCount();
}

O meu formulário funciona bem no sentido de devolver as consultas durante o seu preenchimento.

https://imgur.com/a/Hi5z04u

P.S.

Não liguem ao CSS.. é algo que ainda ando a debater-me visto que alguns imports não permitem que os meus botões da datatable apareçam devidamente.

O helper.php detém as funções públicas

 

<?php
require_once '../database/database_connection.php';
if(!isset($_SESSION['type']))
{
	header("Location: ../login.php");
	die;
}

function selectCategoryList($conn)
{
	if($_SESSION['type']!='master')
	{
		header("Location : ../user");
		die;
	}
	$query = "SELECT * FROM category WHERE categoryStatus ='active' ORDER BY categoryName ASC ";
	$stmt = $conn->prepare($query);
	$stmt->execute();
	$result = $stmt->fetchAll();
	$output = '';
	foreach($result as $r)
	{
		$output .= '<option class="categoryList" value="'.$r['categoryID'].'">'.$r['categoryName'].'</option>';
	}
	return $output;

}
function selectCountryList($conn)
{
	if($_SESSION['type']!='master')
	{
		header("Location : ../user");
		die;
	}
	$query = "SELECT * FROM country WHERE countryStatus ='active' ORDER BY countryName ASC ";
	$stmt = $conn->prepare($query);
	$stmt->execute();
	$result = $stmt->fetchAll();
	$output = '';
	foreach($result as $r)
	{
		$output .= '<option class="countryList" value="'.$r['countryID'].'">'.$r['countryName'].'</option>';
	}
	return $output;

}

function selectLabelList($conn)
{
	if($_SESSION['type']!='master')
	{
		header("Location : ../user");
		die;
	}
	$query = "SELECT * FROM label WHERE labelStatus ='active' ORDER BY labelName ASC ";
	$stmt = $conn->prepare($query);
	$stmt->execute();
	$result = $stmt->fetchAll();
	$output = '';
	foreach($result as $r)
	{
		$output .= '<option class="labelList" value="'.$r['labelID'].'">'.$r['labelName'].'</option>';
	}
	return $output;

}
function selectBrandList($conn)
{
	if($_SESSION['type']!='master')
	{
		header("Location : ../user");
		die;
	}
	$query = "SELECT * FROM brand WHERE brandStatus ='active' ORDER BY brandName ASC ";
	$stmt = $conn->prepare($query);
	$stmt->execute();
	$result = $stmt->fetchAll();
	$output = '';
	foreach($result as $r)
	{
		$output .= '<option class="brandList" value="'.$r['brandID'].'">'.$r['brandName'].'</option>';
	}
	return $output;

}

function selectSupplierList($conn)
{
	if($_SESSION['type']!='master')
	{
		header("Location : ../user");
		die;
	}
	$query = "SELECT * FROM supplier WHERE supplierStatus ='active' ORDER BY supplierName ASC ";
	$stmt = $conn->prepare($query);
	$stmt->execute();
	$result = $stmt->fetchAll();
	$output = '';
	foreach($result as $r)
	{
		$output .= '<option class="supplierList" value="'.$r['supplierID'].'">'.$r['supplierName'].'</option>';
	}
	return $output;

}

function selectLocationList($conn)
{
	if($_SESSION['type']!='master')
	{
		header("Location : ../user");
		die;
	}
	$stmt = $conn->prepare($query);
	$stmt->execute();
	$result = $stmt->fetchAll();
	$output = '';
	foreach($result as $r)
	{
		$output .= '<option class="locationList" value="'.$r['locationID'].'">'.$r['locationName'].'</option>';
	}
	return $output;

}

function selectProductList($conn)
{
	if($_SESSION['type']!='master')
	{
		header("Location : ../user");
		die;
	}
	$query = "SELECT * FROM product WHERE productStatus = 'active' ORDER BY productID ASC ";
	$stmt = $conn->prepare($query);
	$stmt->execute();
	$result = $stmt->fetchAll();
	$output = '';
	if(!empty($result))
	{
		$output .= '<label for="brandID">Brand</label>
		<select class="form-control" id="brandID" name="brandID" required>';
		foreach($result as $r)
		{
			$output .= '<option class="brandList" value="'.$r['brandID'].'">'.$r['brandName'		].'</option>';
		}
		$output .= '</select>';
	}
	else
	{
		$output .= '<p class="text-danger">Erro. </p>';
	}

	return $output;

}
function getUserName($conn, $userID)
{
	$query = "SELECT userName FROM user WHERE userID = '".$userID."' ";
	$stmt = $conn->prepare($query);
	$stmt->execute();
	$result = $stmt->fetchAll();
	foreach($result as $r)
	{
		return $r['userName'];
	}
}

function getAllProduct($conn)
{
	$query = "SELECT productID FROM  product WHERE productStatus='active'";
	$stmt = $conn->prepare($query);
	$stmt->execute();
	$result = $stmt->fetchAll();
	$data = [];
	foreach ($result as $r) {
		$data[]=$r['productID'];
	}
	return $data;
}
function getProductByID($productID, $conn)
{
	$query = "SELECT * FROM  product WHERE productID = '".$productID."' ";
	$stmt = $conn->prepare($query);
	$stmt->execute();
	$result = $stmt->fetchAll();
	$data = [];
	foreach ($result as $r) {
		$data[] = $r['productBasePrice'];
		$data[] = $r['productTax'];
		$data[] = $r['productQuantity'];
		$data[] = $r['productName'];
	}
	return $data;
}

A minha BD

-- phpMyAdmin SQL Dump
-- version 5.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Tempo de geração: 16-Mar-2020 às 11:50
-- Versão do servidor: 10.4.11-MariaDB
-- versão do PHP: 7.4.3

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Banco de dados: `inventory_management`
--

-- --------------------------------------------------------

--
-- Estrutura da tabela `brand`
--

CREATE TABLE `brand` (
  `brandID` int(12) NOT NULL,
  `brandName` varchar(100) DEFAULT NULL,
  `brandStatus` enum('active','inactive') DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


-- --------------------------------------------------------

--
-- Estrutura da tabela `category`
--

CREATE TABLE `category` (
  `categoryID` int(12) NOT NULL,
  `categoryName` varchar(100) DEFAULT NULL,
  `categoryStatus` enum('active','inactive') DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


-- --------------------------------------------------------

--
-- Estrutura da tabela `country`
--

CREATE TABLE `country` (
  `countryID` int(12) NOT NULL,
  `countryName` varchar(100) DEFAULT NULL,
  `countryStatus` enum('active','inactive') DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Estrutura da tabela `label`
--

CREATE TABLE `label` (
  `labelID` int(12) NOT NULL,
  `labelName` varchar(100) DEFAULT NULL,
  `labelStatus` enum('active','inactive') DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


-- --------------------------------------------------------

--
-- Estrutura da tabela `location`
--

CREATE TABLE `location` (
  `locationID` int(12) NOT NULL,
  `countryID` int(12) NOT NULL,
  `locationName` varchar(100) DEFAULT NULL,
  `locationStatus` enum('active','inactive') DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Estrutura da tabela `product`
--

CREATE TABLE `product` (
  `productID` int(12) NOT NULL,
  `productName` varchar(100) NOT NULL,
  `countryID` int(12) NOT NULL,
  `locationID` int(12) NOT NULL,
  `sublocationID` int(12) NOT NULL,
  `categoryID` int(12) NOT NULL,
  `subcategoryID` int(12) NOT NULL,
  `brandID` int(12) NOT NULL,
  `supplierID` int(12) NOT NULL,
  `productQuantity` int(11) NOT NULL,
  `productUnit` varchar(50) NOT NULL,
  `productDescription` varchar(200) NOT NULL,
  `ipAddress` varchar(15) NOT NULL,
  `serialNumber` varchar(50) NOT NULL,
  `label1` int(11) NOT NULL,
  `label2` int(11) NOT NULL,
  `label3` int(11) NOT NULL,
  `productEnterBy` int(11) NOT NULL,
  `productStatus` enum('active','inactive') NOT NULL,
  `productDate` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Estrutura da tabela `subcategory`
--

CREATE TABLE `subcategory` (
  `subcategoryID` int(12) NOT NULL,
  `categoryID` int(12) NOT NULL,
  `subcategoryName` varchar(100) DEFAULT NULL,
  `subcategoryStatus` enum('active','inactive') DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


-- --------------------------------------------------------

--
-- Estrutura da tabela `sublocation`
--

CREATE TABLE `sublocation` (
  `sublocationID` int(12) NOT NULL,
  `locationID` int(12) NOT NULL,
  `sublocationName` varchar(100) DEFAULT NULL,
  `sublocationStatus` enum('active','inactive') DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


-- --------------------------------------------------------

--
-- Estrutura da tabela `supplier`
--

CREATE TABLE `supplier` (
  `supplierID` int(12) NOT NULL,
  `supplierName` varchar(100) DEFAULT NULL,
  `supplierStatus` enum('active','inactive') DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


-- --------------------------------------------------------

--
-- Estrutura da tabela `user`
--

CREATE TABLE `user` (
  `userID` int(11) NOT NULL,
  `userEmail` varchar(70) DEFAULT NULL,
  `userPassword` varchar(100) DEFAULT NULL,
  `userName` varchar(50) DEFAULT NULL,
  `userType` enum('master','user') DEFAULT NULL,
  `userStatus` enum('active','inactive') DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


--
-- Índices para tabelas despejadas
--

--
-- Índices para tabela `brand`
--
ALTER TABLE `brand`
  ADD PRIMARY KEY (`brandID`);

--
-- Índices para tabela `category`
--
ALTER TABLE `category`
  ADD PRIMARY KEY (`categoryID`);

--
-- Índices para tabela `country`
--
ALTER TABLE `country`
  ADD PRIMARY KEY (`countryID`);

--
-- Índices para tabela `label`
--
ALTER TABLE `label`
  ADD PRIMARY KEY (`labelID`);

--
-- Índices para tabela `location`
--
ALTER TABLE `location`
  ADD PRIMARY KEY (`locationID`);

--
-- Índices para tabela `product`
--
ALTER TABLE `product`
  ADD PRIMARY KEY (`productID`);

--
-- Índices para tabela `subcategory`
--
ALTER TABLE `subcategory`
  ADD PRIMARY KEY (`subcategoryID`);

--
-- Índices para tabela `sublocation`
--
ALTER TABLE `sublocation`
  ADD PRIMARY KEY (`sublocationID`);

--
-- Índices para tabela `supplier`
--
ALTER TABLE `supplier`
  ADD PRIMARY KEY (`supplierID`);

--
-- Índices para tabela `user`
--
ALTER TABLE `user`
  ADD PRIMARY KEY (`userID`);

--
-- AUTO_INCREMENT de tabelas despejadas
--

--
-- AUTO_INCREMENT de tabela `brand`
--
ALTER TABLE `brand`
  MODIFY `brandID` int(12) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7018;

--
-- AUTO_INCREMENT de tabela `category`
--
ALTER TABLE `category`
  MODIFY `categoryID` int(12) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10018;

--
-- AUTO_INCREMENT de tabela `country`
--
ALTER TABLE `country`
  MODIFY `countryID` int(12) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16006;

--
-- AUTO_INCREMENT de tabela `label`
--
ALTER TABLE `label`
  MODIFY `labelID` int(12) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=50009;

--
-- AUTO_INCREMENT de tabela `location`
--
ALTER TABLE `location`
  MODIFY `locationID` int(12) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14021;

--
-- AUTO_INCREMENT de tabela `product`
--
ALTER TABLE `product`
  MODIFY `productID` int(12) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=100001;

--
-- AUTO_INCREMENT de tabela `subcategory`
--
ALTER TABLE `subcategory`
  MODIFY `subcategoryID` int(12) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18013;

--
-- AUTO_INCREMENT de tabela `sublocation`
--
ALTER TABLE `sublocation`
  MODIFY `sublocationID` int(12) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15003;

--
-- AUTO_INCREMENT de tabela `user`
--
ALTER TABLE `user`
  MODIFY `userID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6006;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

Já ando a partir a cabeça à 3 dias de volta disto. Conseguem ajudar por favor ?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.