Reply to Re: resultset and two tables in sql query

Your name:

Reply:


Posted by J.O. Aho on 12/04/07 05:30

bender wrote:

> In PHP4 was mysql_result which produced resultset with
> tableName.fieldName (if my memory is good:
> $mysql_result($rs,$i,tableName.fieldName)) and I wonder if is possible
> to get in PHP5 with mysqli?

I can say I never got that in PHP4 nor PHP5. FRom the manual for
mysql_fetch_array:

If two or more columns of the result have the same field names, the last
column will take precedence. To access the other column(s) of the same name,
you must use the numeric index of the column or make an alias for the column.
For aliased columns, you cannot access the contents with the original column name.

and mysqli_fetch_array:

If two or more columns of the result have the same field names, the last
column will take precedence and overwrite the earlier data. In order to access
multiple columns with the same name, the numerically indexed version of the
row must be used.

So you will need to use AS in the query if you want to emulate the tablename
included in the column name.

--

//Aho

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация