Я новичок в mysqli и схожу с ума по массиву.
я получаю этот массив:
array(5) {
[0]=>
object(stdClass)#11422 (1) {
["ingredientes"]=>
string(6) "Frango"
}
[1]=>
object(stdClass)#11419 (1) {
["ingredientes"]=>
string(10) "Mozzarella"
}
[2]=>
object(stdClass)#11423 (1) {
["ingredientes"]=>
string(5) "Caril"
}
[3]=>
object(stdClass)#11420 (1) {
["ingredientes"]=>
string(5) "Natas"
}
[4]=>
object(stdClass)#11424 (1) {
["ingredientes"]=>
string(6) "Cebola"
}
}
, и я хочу "напечатать" только "Fran go", "Mozarella", "Caril" и др. c ...
я уже пробовал:
while($result_row = mysqli_fetch_assoc($result)) {
echo $oresult_row['ingredientes'];
}
foreach($result as $key => $ingredientes){
echo $result[$key][];
}
foreach($result as $key => $name){
echo $result[$key];
}
while ($i < count($result)) {
echo $result[$i]->row['name'];
$i++;
}
for ($i = 0; $i < count($result); $i++ ) {
echo $result[0][$i];
}
Я работаю с WordPress, и это тот, кто получает массив :
$id = $product->id;
global $wpdb;
$query = "SELECT wt.name FROM wp_term_relationships wtr JOIN wp_term_taxonomy wtt ON wtr.term_taxonomy_id = wtt.term_taxonomy_id JOIN wp_terms wt ON wt.term_id = wtt.term_id JOIN wp_posts wp ON wp.ID = wtr.object_id WHERE wp.ID =" . $id . " AND wtt.taxonomy = 'Ingrediente'";
$result = $wpdb->get_results($query);