Jump to content

gildas-Milandou

New Members
  • Posts

    5
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

gildas-Milandou's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Total_price come from the previous value, when I displayed the dynamic data: $get_ip_add = getIPAddress(); $total_price=0; $cart_query="select * from `cart_details` where ip_address='$get_ip_add'"; $result=mysqli_query($con,$cart_query); while($row=mysqli_fetch_array($result)) { $product_id=$row['product_id']; $select_products="select * from `products` where product_id='$product_id'"; $result_products=mysqli_query($con,$select_products); while($row_product_price=mysqli_fetch_array($result_products)) { $product_price=array($row_product_price['product_price']); $price_table=$row_product_price['product_price']; $product_title=$row_product_price['product_title']; $product_imaage1=$row_product_price['product_image1']; $product_values=array_sum($product_price); $total_price+=$product_values;
  2. I am trying to update the item in my php code, but I got this error: Here is my code $get_ip_add = getIPAddress(); if(isset($_POST['update_cart'])){ $quantities=$_POST['qty']; $update_cart="update `cart_details` set quantity=$quantities where ip_address='$get_ip_add'"; $result_products_quantity=mysqli_query($con,$update_cart); $total_price=$total_price*$quantities; } Here is the error message that is displaying: Warning: A non-numeric value encountered in C:\xampp\htdocs\E-commerce-website\basket.php on line 260 on this line : $total_price=$total_price*$quantities; Can I haave your help please, thank you.
  3. I have an error in my code, I am trying to display the total amount of each user unsing Total cart price: here is the code : // Total price function function total_cart_price(){ global $con; $get_ip_add = getIPAddress(); $total_price=0; $cart_query="select * from `cart_details` where ip_address=' $get_ip_add'"; $result=mysqli_query($con,$cart_query); while($row=mysqli_fetch_array($result)){ $product_id=$row['product_id']; $select_products="select * from `products` where product_id='$product_id'"; $result_products=mysqli_query($con,$select_products); while($row_product_price=mysqli_fetch_array($result_products)){ $product_price=array($row_product_price['product_price']); $product_values=array_sum($product_price); $total_price+=$product_values; } } echo $total_price; } And here is the final displayed of the executing code: Total Price: 0 . Nothing is showing and there is not a error message too. Can someone help me please ? I mean the is nothing that showed, Total Price: 0.
  4. Here is a message error that I got after trying to get a data from a database by pressing search button: Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, bool given inC:\xampp\htdocs\E-commerce-website\functions\common_function.phpon line237 Here is the code it is a function call search_product: function search_product(){ global $con; if(isset($_GET['search_data_product'])) { $search_data_value=$_GET['search_data']; $search_query="select * from `products` where product_keywords like `%search_data_value%`"; $result_query=mysqli_query($con,$search_query); while($row=mysqli_fetch_assoc($result_query)) { $product_id=$row['product_id']; $product_title=$row['product_title']; $product_description=$row['product_description']; $product_image1=$row['product_image1']; $product_image2=$row['product_image2']; $product_image3=$row['product_image3']; $product_price =$row['product_price']; $category_id=$row['category_id']; $brand_id=$row['brand_id']; echo " "
  5. This is the error message that I got after trying to uploaded an images : Warning: move_uploaded_file(): The second argument to copy() function cannot be a directory in C:\xampp\htdocs\E-commerce-website\admin_area\insert_products.php on line 30 Warning: move_uploaded_file(): Unable to move 'C:\xampp\tmp\php887B.tmp' to './product_images/' in C:\xampp\htdocs\E-commerce-website\admin_area\insert_products.php on line 30 Warning: move_uploaded_file(): The second argument to copy() function cannot be a directory in C:\xampp\htdocs\E-commerce-website\admin_area\insert_products.php on line 31 Here is my PHP code : <?php include('../includes/connect.php'); if(isset($_POST['insert_product'])){ $product_title=$_POST['product_title']; $description=$_POST['description']; $product_keywords=$_POST['product_keywords']; $product_category=$_POST['product_category']; $product_brands=$_POST['product_brands']; $product_price=$_POST['product_price']; $product_status='true'; // Accessing images $product_image1=$_FILES['product_image1']['name']; $product_image2=$_FILES['product_image2']['name']; $product_image3=$_FILES['product_image3']['name']; // Accessing images tmp name $temp_image1=$_FILES['product_image1']['tmp_name']; $temp_image2=$_FILES['product_image2']['tmp_name']; $temp_image3=$_FILES['product_image3']['tmp_name']; //Checking empty condition if($product_title=='' or $description=='' or $product_keywords='' or $product_category='' or $product_brands='' or $product_price='' or $product_image1='' or $product_image2='' or $product_image3=''){ echo '<script>alert("Please fill all the available fields")</script>'; exit(); }else{ move_uploaded_file($temp_image1,"./product_images/$product_image1"); move_uploaded_file($temp_image2,"./product_images/$product_image2"); move_uploaded_file($temp_image3,"./product_images/$product_image3"); // Insert query $insert_products="insert into `products` (product_title,product_description, product_keywords,category_id,brand_id,product_image1,product_image2, product_image3,product_price,date,status) values('$product_title','$description','$product_keywords','$product_category', '$product_brands','$product_image1','$product_image2','$product_image3','$product_price',NOW(),'$product_status')"; $result_query=mysqli_query($con,$insert_products); if($result_query) { echo '<script>alert("Successfully inserted the products")</script>'; } } } And here my HTML code: <!DOCTYPE html> <html> <h1>Insert products</h1> <form action="" method="POST" enctype="multipart/form-data"> <div class=" form-group"> <label for="product_title">Product title</label> <input id="product_title" name="product_title" type="text" class="form-control" placeholder="Enter product title" autocomplete="off" required="required"> </div> <div class=" form-group"> <label for="description">Product description</label> <input id="description" name="description" type="text" class="form-control" placeholder="Enter product description" autocomplete="off" required="required"> </div> <div class=" form-group"> <label for="product_keywords">Product keywords</label> <input id="product_keywords" name="product_keywords" type="text" class="form-control" placeholder="Enter product keywords" autocomplete="off" required="required"> </div> <!-- Categories --> <div class="form-group"> <select name="product_category" id="" class="form-control product_category"> <option value="">Select a Category</option> <?php $select_query="select * from categories"; $result_query=mysqli_query($con,$select_query); while($row=mysqli_fetch_assoc($result_query)){ $category_title=$row['category_title']; $category_id=$row['category_id']; echo "<option value='$category_id'>$category_title</option>"; } ?> </select> </div> <!-- Brands --> <div class="form-group"> <select name="product_brands" class="form-control"> <option value="">Select a Brand</option> <?php $select_query="select * from brands"; $result_query=mysqli_query($con,$select_query); while($row=mysqli_fetch_assoc($result_query)){ $brand_title=$row['brand_title']; $brand_id=$row['brand_id']; echo "<option value='$brand_id'>$brand_title</option>"; } ?> </select> </div> <div class="form-group"> <label for="product_image1">Product image 1</label> <input type="file" class="form-control" id="product_image1" name="product_image1" required="required"> </div> <div class="form-group"> <label for="product_image2">Product image 2</label> <input type="file" class="form-control" id="product_image2" name="product_image2" required="required"> </div> <div class="form-group"> <label for="product_image3">Product image 3</label> <input type="file" class="form-control" id="product_image3" name="product_image3" required="required"> </div> <div class=" form-group"> <label for="product_price">Product title</label> <input id="product_price" name="product_price" type="text" class="form-control" placeholder="Enter product price" autocomplete="off" required="required"> </div> <div class="text-left"> <input type="submit" name="insert_product" class="btn btn-primary" value="Insert products"> </div> </form> </div> </div> </div> </div> </div> </div> <!--End --> </html>
×
×
  • Create New...

Important Information

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.