V
V
vitalykostak2019-04-30 17:02:58
PHP
vitalykostak, 2019-04-30 17:02:58

How to solve the problem of retrieving data from a DB using Read Bean PHP?

$districts = R::find('districtofcities', "Belonging_to_the_city = ?", array("Киев"));

I am looking for records in the database in the table 'districtofcities', where the column is "Belonging_to_the_city = Kiev"
then I display this BIN like this
echo '<pre>';
print_r($districts);
echo '</pre>';

Everything super displays as it should, but if I try to display a specific record of a specific field
foreach ($districts as $key){
echo '$key->Belonging_to_the_city';
}

It already displays empty lines, what kind of mysticism, who knows?
BIN is full, but if you display a specific line, then it is already an empty entry

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2019-04-30
@FanatPHP

Most importantly, I set the difficulty to medium.
There have been a lot of questions about RB lately. and all questions have one characteristic feature: the questioners do not know php. In general, from the word "absolutely". It seems that someone recruited schoolchildren for courses, but for some reason teaches one little-known library and nothing more.
And as a result, there are questions like this, "I don't know how to display the value of a variable in the browser, sorry."
I'm talking about logic in general.
"Everything super outputs as it should" means that the data was extracted successfully, there are no problems with this.
But the question, nevertheless, is called "How to solve the problem of extracting data from the database".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question