jcb789 Posted October 24, 2020 Share Posted October 24, 2020 (edited) Hi everyone for my end of studies projects I decided to do a little e-commerce problem on the filter .. I use an ajax request at the click of the checkbox this goes to my controller which calls a method of my Model class but the concern is that .. if the array $ _POST ['brands'] has several elements then only the last one is returned to me? I thought I saw one day that if the same variable is in a url then the last value will be returned to me is for security but how can I do ... I have been there for too long .. and finally despair. . Help me please... :') request payload: brands%5B%5D=arai&brands%5B%5D=bell reply : <- prepare var_dump () object (PDOStatement) # 2 (1) {["queryString"] => string (73) "SELECT mark FROM articles WHERE categorie_article =? AND mark IN (?,?)"} string (4) "arai" <- bind string (4) "bell" <- bind var_dump () of my fetchAll () array (2) {[0] => array (2) {["brand"] => string (4) "bell" [0] => string (4) "bell"} [1] => array (2 ) {["brand"] => string (4) "bell" [0] => string (4) "bell"}} image_icon since the last value taken into account is bell then I get two items of the bell brand from my bdd but no arai ... Edited October 24, 2020 by jcb789 error Quote Link to comment https://forums.phpfreaks.com/topic/311634-only-the-last-value-of-my-array-is-return/ Share on other sites More sharing options...
gw1500se Posted October 24, 2020 Share Posted October 24, 2020 (edited) You will get better help if you show your actual code. Pseudo code does not help us help you. Also be sure to use the code icon (<>) and specify PHP. Edited October 24, 2020 by gw1500se Quote Link to comment https://forums.phpfreaks.com/topic/311634-only-the-last-value-of-my-array-is-return/#findComment-1582026 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.