Re: Issues with array counts
- From: "Rik" <luiheidsgoeroe@xxxxxxxxxxx>
- Date: Sat, 24 Jun 2006 03:12:54 +0200
427SOHC wrote:
In article <0NUmg.5431$1g.1061@xxxxxxxxxxxxxxxxxxxx>, PSI_Orion
says...
I have a table set up which has 4 columns. However, when I use the
sizeof() function on the array, it always returns DOUBLE the number
of columns. Here is an extract of my code...
Can anyone explain why?if you check the mysql_fetch_array() function at php.net, the first
"contributed notes" talks about the scenario you described. From my
understanding mysql_fetch_array returns two arrays, the scalar and
associative arrays, so that doubles your count.
If you switch to the mysql_fetch_assoc function that should return
back a single array to give you a more accurate count, without have
to rig your code to divide by 2. : )
Or mysql_fetch_row() if you;re only using the numerical one.
One side note, where I'm doing a lot of testing and I'm using auto
increment on the ID field, how can I restet the values so it starts
from, lets say, 2 instead of 50?
ALTER TABLE `tablename` AUTO_INCREMENT = 2
Grtz,
--
Rik Wasmus
.
- References:
- Issues with array counts
- From: PSI_Orion
- Issues with array counts
- Prev by Date: Re: How to format text in a mailto:
- Next by Date: How to check form -> email
- Previous by thread: Re: Issues with array counts
- Next by thread: How to format text in a mailto:
- Index(es):
Relevant Pages
|