Hello,
How do you get of product IDs AND amounts?
as an array
Thanks in advance
You’ll need to explain a bit better as to what you are wanting to do. Post the code you currently have also.
Thank you for your answer
[php]
Ok, you still didn’t answer the question. What are you trying to do? What are you having issues with? Your code means nothing to use if we don’t know what the expected results needs to be.
I’m sorry, I do not know English, I can not make a detailed description
page1.php, page2.php, page3.php … etc, Next, Next, Next …
Select the optional product
If it is entered amount, OR Amounts entered in the products, on the next page, I’d like to get the ID and amunts
My SQL Table
product_id product_amount
23 4
12 1
45 6
I just, entered the amount of product on the next page, I’d like to get the IDs and Amounts
next page, $_POST[‘product_ids_and_amunts’]
Thanks
If you have trouble understanding all of the English, use Google translate to help fill in the blanks!
You want to return the result set of your query as an array, and you want all of the results that have a product amount that is not NULL and non-zero (i.e., there is product available). This is relatively easy to do with multidimensional arrays. Simply fetch each row from the database as an array, and then insert each row as an element into another array. Then, as you move from page to page, you will likely have to pass the information through a PHP Session (since I don’t know off-hand whether variables in PHP are able to be accessed between requests (i.e., persistent)).
It also seems that you are constructing a form for each type of product ID; a form so large you are paginating across different PHP scripts. Instead of having to perform PHP Session trickery, you could simply change your form so you can enter the Product ID and the amount you want to change for the product with that ID. While this won’t let you change multiple products at a time, it is much less error prone and simpler to code.
I just need some help here
[PHP]
According to this table should be the div?
[PHP]
foreach ($_SESSION[‘table’] as $id => $data){
if ($_POST[‘diplexer’] == $id + 1){
foreach ($data as $value){
$splitter = explode(’+’, $value);
$selected_product_ids[] = $splitter[0];
$selected_product_amounts[] = $splitter[1];
}
}
}
[/PHP]