Thank you FG - this is exactly what I needed.
I think I 've got the query perfect, but how best to display like:
5 jane doe send_rep
4 mignon hunter tic 2-3, send_rep
here's my query:
$query = "SELECT cust.id, first, last, company, choice FROM cust, contact
where cust.id = contact.id";
while ($row = mysql_fetch_assoc($res)) {
print_r[4row]
}
this yields me:
Array
(
[id] => 5
[first] => jane
[last] => doe
[company] =>
[choice] => send_rep
)
Array
(
[id] => 4
[first] => mignon
[last] => hunter
[company] => tic
[choice] => 2-3
)
Array
(
[id] => 4
[first] => mignon
[last] => hunter
[company] => tic
[choice] => send_rep
)
>>> "fgc" <[EMAIL PROTECTED]> 04/08/04 11:01AM >>>
Hi all, new to the list :)
I would try something like this:
Select name, company, choice
>From Table1, Table2
Where Table1.id = Table2.id;
Fg
> Can someone please help me or direct me to some scripts that might get
> me unstuck, as I've not done this kind of query before.
>
> To simplify:
>
> Table1
> id 1
> Name John Doe
> company IBM
>
> Table 2
> id 1
> choice choice #1
> id 1
> choice choice #2
>
> So I have 2 records in table 2 that I need to tie in with id # 1 in
> table 1.
>
> What's the smartest way to do the query ? I have 5 different tables I
> need to query. I guess I can get the data I want by selecting all
> from the 5 tables then parsing through like:
>
> while ($row = mysql_fetch_assoc($res)) {
> foreach Table1.id {
> if Table1.id == Table2.id{
> echo <tr>
> }}}
>
> I could probably manage if I do 5 different queries with 5 different
> results sets, but that is obviously inelegant and would create more
> overhead
>
> I need to display as:
>
> John Doe IBM Choice #1, Choice #2
>
> Am I even close ? Need some help with the logic...
>
> Thx for any guidance
>
> mignon
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php