[thelist] PHP - Can write to [head] tag?

dan donaldson dan at omnivore.ca
Tue Mar 5 17:16:01 CST 2002


On Tuesday, March 5, 2002, at 06:04  PM, Luther, Ron wrote:

> Any idea why:
>
>   $row = mysql_fetch_row($result);
>    echo("<br><br> alt " . $row[0]);
> ***** this row returns the correct value from my database field - which
> is called "alt" - 'cuz it's the alt tag for the random picture that's
> [alledgedly] going to be shown if I can get this bugger working *****
>
>    echo('<br><br> alt with double quote ' . $row["alt"]);
> ***** this line gives me a blank - nada *****

Ron:

you are grabbing the data from the query as an ennumerated (not
associative) array.

Try grabbing it as

mysql_fetch_array($result)

this preserves the field names and allows you to reference the result by
the name or alias in the query. Your code allows it to be referred to by
numerical reference.


HTH

dan




More information about the thelist mailing list