question about mysql_fetch_array ()

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

given the query:

SELECT * FROM customers
left join addresses
on customer.cusid=addresses.cusid

The mysql monitor returns all fields from both tables, including
repeating the field matching the on condition (cusid).

mysql_fetch_array() does not return the matching field from the joined

If I use the using() conditional I get the same non repeated result, in
both mysql monitor and mysql_fetch_array().

Is it safe rely on this non repeating property of the
mysql_fetch_array() function?

I'm not sure it really makes a difference since data assignment would be
in the form of DataFromField= $row["cusid"], but I have learned from
experience that thinking something will never make any difference is risky.

Re: question about mysql_fetch_array ()

I ran into that especially if you use a lot of left joins.. what I do
now is i make sure the correct value is assigned in my query:

MySQL code includes lines like:

 b.fieldname AS fieldname
 btable AS b

where the are multiple instances of fieldname in various tables, but
btable has the known true value.

Site Timeline