You are here: Re: Issues with array counts « All PHP « IT news, forums, messages
Re: Issues with array counts

Posted by Rik on 06/24/06 01:12

427SOHC wrote:
> In article <0NUmg.5431$1g.1061@newsfe1-win.ntli.net>, 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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация