When to use $sth->fetchrow_hashref, $sth->fetchrow_arrayref and $sth->fetchrow_array?

前端 未结 5 1938
遇见更好的自我
遇见更好的自我 2021-02-08 01:48

I know that:

  • $sth->fetchrow_hashref returns a hashref of the fetched row from database,
  • $sth->fetchrow_arrayref returns an
5条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-08 02:47

    In general, I use fetchrow_hashref (I get around two columns with the same name issue by using alias in the SQL), but I fall back to fetch (AKA fetchrow_arrayref) if I need it to be faster. I believe that fetchrow_array is there for people who don't know how to work with references.

提交回复
热议问题