I've got a problem in a script i'm writing.. I don't understand how to easily pull information out of multiple returned rows.
Up until now, I've been pulling information from my database with mysql_fetch_object($result)
where $result is obviously the result of my query.. mainly because I can still work with the field names in my database - which is a lot easier than an array of indexes.
My SQL Query LEFT JOIN's several tables.. we'll call them
Personnel_info, Dependant_Info, and Spouse_Info
If my query returned a visual table it would look like the following
Personnel_Info Dependant_Info Spouse_Info
pi_fname, pi_lname, pi_address di_fname, di_lname, di_sex si_fname, si_lname, si_anniversary
James Jones 333 Street Mike Jones M Sarah Jones 2000-01-01
James Jones 333 Street Anne Douglass F Sarah Jones 2000-01-01
James Jones 333 Street David Jones M Sarah Jones 2000-01-01
I can access the first row of the returned result just fine,
however I don't know - and have been unsuccessful at finding the answer on - how to access the other returned rows on a mysql_fetch_object statement..
So basically - I am unable to display the child dependants of James Jones (both Anne and David) (object class) or I get James Jones and Sarah Jones several times through procedural code..
I'm dealing with around 210 different columns in this one query through about 14 table joins and - as far as I see it using objects is the easiest way to pull the information and use it the way I see fit.
It worked well for all the tables that are guaranteed to display only one row of information. :-\
Anything?
-Kedaeus