Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

1 Neutral


  • Rank
    Advanced Member

Contact Methods

  • AIM
  • MSN
  • Yahoo
  • Skype

Profile Information

  • Gender
  • Location
  • Interests
    Computer, Playing Video Games, Learning
  1. This is what i did and the error: Fatal error: Cannot pass parameter 2 by reference $update = $pdo->prepare(" UPDATE stocks SET item_qty = :item_qty WHERE category = :category AND product_name = :product_name AND item_size = :item_size AND item_type = :item_type "); foreach($_POST['category'] as $k => $category){ $update->bindParam(':item_qty', $item_q - $_POST['item_qty'][$k]); $update->bindParam(':product_name', $_POST['product_name'][$k]); $update->bindParam(':item_type', $_POST['item_type'][$k]); $update->bindParam(':item_size', $_PO
  2. Good day. I still havent been able to update the stocks. I have tried so many things and encountered various errors: Cannot pass parameter 2 by reference Fatal error: Cannot pass parameter 2 by reference Please can you help me with the update stuff? Thanks
  3. Thanks. but am working on the form type version. Will look at the other version later. thanks
  4. Hello, I tried doing some deduction from another table but its giving me Array to string conversion $update = $pdo->prepare(" UPDATE stocks SET item_qty = item_qty - '$_POST[item_qty]' WHERE category = '$category' AND product_name = '$_POST[product_name]' AND item_type = '$_POST[item_type]' AND item_size = '$_POST[item_size]' "); $update->execute();
  5. Thank you very much. All seem to be working well for now. I had to delete the table and start all over again. The form version is working well.
  6. I cant seem to locate trans_id and the error is reporting as duplicate should be trans_ref and not trans_id. however, the trans_ref is the reference for the transaction. since we can have multiple items in a single transaction/session. thanks
  7. oops! oversight. this is what i got: Array ( [category] => Array ( [0] => Beverages [1] => Milk [2] => Cereals [3] => Beverages [4] => Milk ) [product_name] => Array ( [0] => Bournvita [1] => Dano [2] => Golden morn [3] => Milo [4] => Peak ) [item_type] => Array ( [0] => Refill [1] => Evap
  8. Yeah. I have read it. But this error: Warning: Invalid argument supplied for foreach() is from your own code: the line number is 127: foreach ($_POST['category'] as $k => $category) {
  9. Array ( [category] => Milk [product_name] => Peak [item_type] => Refill [item_size] => 380 [item_qty] => 2 [item_price] => 3500 [price] => 7000 [total_price] => ₦26,300.00 [send] => Complete Shopping )
  10. Thanks so very much. Will try out your second option and the table normalization once i get this up and running. But i have having error on your first code: Warning: Invalid argument supplied for foreach() Thanks
  11. Sorry. And thanks for your time. Its no guessing game. I omitted the where the data is coming from. I used a form cos i feel it will work for the purpose, cos i tried to use SELECT, INSERT but since the first table and destination table does not have the same number of rows, it didnt work or I couldnt get it to work and so i decided to use form. The previous code is the POST. Below is the rest of the code $stmt = $pdo->prepare("SELECT * FROM temp_shopping"); $stmt->execute(); $num_rows = $stmt->rowCount(); if($num_rows < 1){ echo '<div class="alert bg-danger text-cente
  12. The data on the form is derived from(a while loop) in a temporal table in the database. From there the data and the summation(total) is to be stored the the actual table. But the problem am having is that only the last row is being inserted into the actual table. Thanks
  13. What do you mean by get rid of the variables for nothing?
  14. Hi guys, I have a table that i want all the entries to be inserted all at once. Mine is just inserting only one of the item, how can i get it to work? I also attached a sample table. Thanks if(isset($_POST['send'])){ $category = $_POST['category']; $item_type = $_POST['item_type']; $item_size = $_POST['item_size']; $product_name = $_POST['product_name']; $item_qty = $_POST['item_qty']; $price = $_POST['price']; $total_price = $_POST['total_price']; $item_price = $_POST['item_price']; $sql = " INSERT INTO shopping( trans_ref, category,
  • 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.