NYCPHP Meetup

NYPHP.org

[nycphp-talk] A few questions

Analysis & Solutions danielc at analysisandsolutions.com
Mon May 19 01:22:10 EDT 2003


Sire:

On Sat, May 17, 2003 at 11:33:15PM -0400, John W. Markert wrote:
> 
> When using PHP with MySQL is there a way to find the index of a
> field/column by providing the associative name? I have n related
> elements in a table that I want to process in a loop and I want to ask
> MySQL where to start processing.

I don't believe there is one directly.  You could try to rig something up
using mysql_fetch_array().  That returns an array containing values of
both assciative and enumerated keys.  Then you might be able to find your
answer using array_search().  Hmm...  Actually, create two arrays.  One
enumerated.  One associative.  Find the value from the associative.  Then
use that value as the needle in the enumerated array "haystack" via
array_search().

But, after all that's said, I don't really see the point.  Why are you 
trying to do this?  Sounds like you're creating a problem or attacking 
something in a way that may be better approachced from another direction.

--Dan

-- 
     FREE scripts that make web and database programming easier
           http://www.analysisandsolutions.com/software/
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7th Ave #4AJ, Brooklyn NY    v: 718-854-0335   f: 718-854-0409



More information about the talk mailing list