I am working with PEAR DB and the associative array function uses a unique index to organize the associative arrays. My problem is that the only unuqie value in any of my tables is an id.
When I query using the id as the first value in the query, that id becomes the array index and is then un-usable by my program. Is there a way to select the same field twice in one query? Anyone know how to access that array key as my id for use in my program. Here's an example of what I mean.
SELECT sa.id as note_id, prospective_student_id as student_id,
entered_by, annotation, sa.created_date, u.first_name
FROM prospective_student_annotations as sa, users as u
WHERE
sa.prospective_student_id = '1'
AND u.id = sa.entered_by
Here's the result. Notice that the id is the array index and therefore I can't use it as an associative field in my program.
Array
(
[1] => Array
(
[student_id] => 1
[entered_by] => 1
[annotation] => This lead is a high profile lead. He's got mad money and we need to enroll him, stat.
[created_date] => 0000-00-00 00:00:00
[first_name] => Don
)
[2] => Array
(
[student_id] => 1
[entered_by] => 2
[annotation] => This guy is a joker. Don't believe the hipe. He's no good.
[created_date] => 0000-00-00 00:00:00
[first_name] => Paul
)
[3] => Array
(
[student_id] => 1
[entered_by] => 2
[annotation] => Anyone want a peanut butter and jelly sandwich?
[created_date] => 2004-07-01 00:00:00
[first_name] => Paul
)
[4] => Array
(
[student_id] => 1
[entered_by] => 2
[annotation] => Hey there
[created_date] => 2004-07-03 00:00:00
[first_name] => Paul
)
)