Why an empty array?

Tell me why the array can be empty? ie when you click on the button named save the record successfully added to the related table. but when you try to get this $_SESSION['logged_user']->ownPapkyList way - the array is empty. is there anything in this record some kind of blunder? learn php for a couple of days. Just if anywhere else was a mistake - the record would not be added, right?

<?php 
 $data = $_POST;
 if (isset($data['save'])) {

 $papka = R::dispense('papki');
 $papka--->imya = $data['papkaname'];

 $_SESSION['logged_user']->ownPapkyList[] = $papka; 
R::store($_SESSION['logged_user']);
 } 

print_r($_SESSION['logged_user']->ownPapkyList);

 ?>


solved.
the decision was in error record ownPapkyList place ownPapkiList. because the linked page is called with the end in i as seen from line $papka = R::dispense('papki'); now everything works
June 8th 19 at 16:53
2 answers
June 8th 19 at 16:55
$_SESSION['logged_user']->ownPapkyList[] = $papka;

this is some bullshit. What is this? What do you generally do?
This shit connects 2 tables by ID.. https://redbeanphp.com/index.php?p=/one_to_many - fanny3 commented on June 8th 19 at 16:58
that's exactly what I wrote, not all together. $_SESSION is an array. The correct answer is that you are trying to mix the concept of an array and an instance of the class.

Why are you, excuse me, on the second day of learning php got into ORM?) You do not need it. - woodrow_Hintz commented on June 8th 19 at 17:01
, how to make a linked table from the session user? - fanny3 commented on June 8th 19 at 17:04
Probably you really do strange. That gives you
print_r($_SESSION['logged_user']);
before
$_SESSION['logged_user']->ownPapkyList[] = $papka; - Guiseppe commented on June 8th 19 at 17:07
thanks to all the "professionals". the decision was in error record ownPapkyList place ownPapkiList. because the linked page is called with the termination in i. now everything works - fanny3 commented on June 8th 19 at 17:10
lol) then it "works", but all you were trying to convey above still makes sense. You have at this stage in 2 ways - either choose a method of podavana and start listening to more experienced colleagues, to grow by leaps and bounds and not to do anything stupid. Or choose method "I", and for many years to fill their own cones, to honokowai such trash and waste from which colleagues back hair will move. As long as you in the beginning. Make the right choice. - Velva.Rogahn commented on June 8th 19 at 17:13
if more experienced colleagues basically said - what is wrong and why you can't write - I'm always willing to listen. and "this is something strange.. why is not working" is not the answer that I would listen. By the way can you tell me what is wrong that should cause perturbations at the back? - fanny3 commented on June 8th 19 at 17:16
,
1. Why $data = $_POST?
2. Class R - what is it? Naming 80go level...
3. An no, Soren - traslit names. This naming of the hidden, level 81.
4. The entry in the session through one place.
5. Static methods R class here and there through the code as if to suggest that understanding OOP very tight.
6. print_r instead of xdebug (which you would all quickly found themselves and this discussion would not be at all).

The reaction of colleagues such because code really is not so. To throw away and rewrite. Rewrite until the enlightenment. - Velva.Rogahn commented on June 8th 19 at 17:19
you familiar at all with to do so? https://redbeanphp.com/index.php?p=/finding
and Yes. nobody said that this is the entire code on the page. this is only one part which was a mistake. and this error does not go beyond this code. that is why I got rid of it.
1. then to save into the variable data obtained before. page.
2. class R is radinovskaya record
3. transliteration names is the latest what you can find fault in training
4. the entry in the session on the login page. and the session itself in the top of each page connects with the base.
5. again, this is redbean
6. the only useful advice about which I did not know. thank you. - fanny3 commented on June 8th 19 at 17:22
what is R in your code is not clear, in the comments anywhere are not mentioned. Telepaths did not deliver. So the question "what is it" absolutely logical and appropriate.
1. They have already stored in the superglobal variable $_POST. Everything you do - spend nothing, and keep. Do you remember exactly the same thing twice.
2. Well, now that this point was cleared up. Would for example DocBlock with var issues would not have arisen. Or mentioned in the description.
3. No, this is one of the first thing is need to find fault. Because naming conventions is one of the corner points in the programming. And if you don't discipline yourself to do it properly, then relearn longer and harder. And the team that you have working with you, will bitterly cry. Well or team lead will be PI**ing chair on the head.
4. Again, we know nothing about it. But because of the Mish-mash of OOP and working directly with the session is straight line in place = the entry in the session through one place.
5. Well, in the case of redbana is not redun and the fa├žade. Actually here initially was the question - the facade seen from afar, but in your code snippet it looks like from another universe.
6. Please. - Velva.Rogahn commented on June 8th 19 at 17:25
June 8th 19 at 16:57
this is a grave error. look how a php array
no errors there except for the error in the name. is all settled and everything works - fanny3 commented on June 8th 19 at 17:00
you have there a minimum of 3 mistakes. So, briefly and without batting an eye. Just eyes hurt and bleed more closely at your code to read - woodrow_Hintz commented on June 8th 19 at 17:03
the specifics? - fanny3 commented on June 8th 19 at 17:06
in the other thread is already answered - Guiseppe commented on June 8th 19 at 17:09
$_SESSION['logged_user'] it is an object of the class?
If Yes, no errors - fanny3 commented on June 8th 19 at 17:12

Find more questions by tags PHP