R
R
RuslanCC2011-09-20 14:04:39
Kohana
RuslanCC, 2011-09-20 14:04:39

Kohana Query Builder - why does it also return a data type?

Good afternoon!
Writing:

$result = DB::select()->from($dbtable)->where('visible', '=', 1)->order_by("order")->execute();<br>
foreach ($result as $cat) var_dump($cat);<br>

I get:
array(6) {<br/>
 [&quot;id&quot;]=&gt;<br/>
 string(1) &quot;1&quot;<br/>
 [&quot;parent&quot;]=&gt;<br/>
 string(1) &quot;0&quot;<br/>
 [&quot;name&quot;]=&gt;<br/>
 string(14) &quot;Главная&quot;<br/>
 [&quot;order&quot;]=&gt;<br/>
 string(3) &quot;999&quot;<br/>
 [&quot;visible&quot;]=&gt;<br/>
 string(1) &quot;1&quot;<br/>
 [&quot;controller&quot;]=&gt;<br/>
 string(5) &quot;index&quot;<br/>
}

Question:
Why is each field value preceded by its type and length? How can I just get the values?
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Kutenko, 2011-09-20
@Sky4eg

Because you're using var_dump/
Функция отображает структурированную информацию об одном или нескольких выражениях, которая включает в себя их тип и значение. Массивы и объекты анализируются рекурсивно с разным отступом у значений для визуального отображения структуры.
proof
To simply display the values, just replace var_dump($cat); echo $cat. ' ';

A
Anatoly, 2011-09-20
@taliban

foreach ($result as $cat) print_r($cat);
Or am I a fool?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question