Page 1 of 1

Correct Syntax

Posted: Fri Dec 22, 2006 6:04 pm
by PastorHank
Would someone please tell me the correct syntax to use to determine which row of a resultset I am working on?
The result set is returned with

Code: Select all

while ($row = mysql_fetch_array($result)) {
  extract($row);
I know the array starts at row[0] but for the life of me, none of my if statements seem to work.


Thank you

Posted: Fri Dec 22, 2006 6:07 pm
by Christopher
Because it can't create variable names that are numbers, try the EXTR_PREFIX_INVALID flag for extract().

Posted: Fri Dec 22, 2006 6:15 pm
by volka
or use mysql_fetch_array($result, MYSQL_ASSOC)
and/or do not extract the elements but use the array like e.g. echo $row['fieldname'];

Posted: Fri Dec 22, 2006 6:32 pm
by PastorHank
Thank you. After enough beating my head against the wall, I simply used a counter set to zero and incremented it after use....it was very much a 'duh' moment.