i know how to perform and use results of mysql queries in php, thanks anyway,
what i wanted is a result looking like this
$result=mysql_query($the_magic_sql_query);
$row=mysql_fetch_array($result);
and magically get something like this:
$row[parent_name] == "john"
$row[parent_id] == 1
$row[how_many_children] == 2
$row[child_id][0] == 8
$row[child_id][1] == 3
$row[child_name][0] == "mary"
$row[child_name][1] == "jack"
you know what i mean? i want arrays, but in some array items i want array's arrays (subarrays?)
if i can't get that from mysql (i'm sure i can't)
i'd like to get something like
$row[parent_name] == "john"
$row[parent_id] == 1
$row[child_ids] == "8,3"
$row[child_names] == "mary,jack"
that'd be great cause y can perform:
$child_ids=explode(",", $row[child_ids]);
$how_many_childs=str_count(",", $row[child_ids]);
NOW I GOT $how_many_childs == 2, $child_ids[0]=="mary" AND $childs[1] == "jack" !!!!! JUST WHAT I WANTED !!!
... but i can't perform that CONCAT-GROUPBY-looking query
all this is to avoid the neanderthal-like method:
$result_parent=mysql_query("SELECT * FROM parents");
while($row_parent=mysql_fetch_array($result_parent))
{
// all echoes and all the stuff
// ...
// the multiple result part....
$result_child=mysql_query("SELECT * FROM children WHERE parent_id=" . $row_parent[id]);
while($row_child=mysql_fetch_array($result_child))
{
// all this parent's children info
}
}
that'd be owful!!! query of a query result???? why should i??