Forum Moderators: coopster
I need to reduce to as little queries as possible, for obvious reasons. I use ADODB to access my databases, so I'm not very familiar with the given mysql php functions, so I'll just write out the queries and explain how they will be used.
So here is an elementary query example:
Query #1, this will only return 1 record, an associative array, with the db field as the key
$record = select * from table_a where id=1
Query #2, this will return multiple records as an array
$record['whatever'] = select * from table_b where cross_reference=$record['id']
So I would end up what a single array like:
$record['field1_from_table_a'] = value;
$record['field2_from_table_a'] = value;
$record['field3_from_table_a'] = value;
$record['field4_from_table_a'] = value;
etc.
$record['whatever'] = array(0 => array('field1'=>'value','field2'=>'value',etc.), 1=>array('field1'=>'value','field2'=>'value',etc.), etc.);
Any way to do this as one query? The following query doesnt work but it may help clarify what I'm trying to ask.
select a.*, b.* as whatever from table_a a, table_b b where a.id=b.cross_reference
Logically thats what I'm trying to do.
Thanks again!