Re: array_search and in_array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I found the trouble.

The content of array had length of 20 and the database didn´t;

Excuse me.

""João Cândido de Souza Neto"" <joao@xxxxxxxxxxxxxxxxxxxxx> escreveu na 
mensagem news:57.00.55355.58AE4B44@xxxxxxxxxxxxxxx
> Hi everyone.
>
> I´m facing a big trouble that a don understand why is it happenin.
>
> I´ve got an array with 1046 elements in it like this.
>
> Here is a part of a print_r of my array.
>
> Array ( [0] => 0001-01 [1] => 0003-01 [2] => 0140-01 [3] => 0141-01 [4] => 
> 0142-01 [5] => 0170-03 [6] => 0181-01 [7] => 0182-04 [8] => 0186-06 [9] => 
> 0186-08 [10] => 0550-01 [11] => 0720-01 [12] => 0730-01 [13] => 0740-01 
> [14] => 0750-01 [15] => 1311-07 [16] => 1316-01 [17] => 1316-02 [18] => 
> 1316-03 [19] => 278980198657138 [20] => 278980198657139 [21] => 
> 278980198657141 [22] => 278980198657142...
>
> I get some data from mysql and try to use both functions that´s in the 
> subject to test if the code returned by database is in array, but it isn´t 
> working.
>
> By a for i pass by each register returned by database and print the code 
> and if it´s in my array, something like this:
>
> for($y=0; $y<$con->count;$y++){
>   $con->Seek($y);
>   echo $con->result['cod_loja']." - 
> ".(array_search($con->result['cod_loja'],$_SESSION["cod_loja"])?"Found":"Not 
> found")."<br>";
>  }
>
> Here is a part of result of the code above:
>
> 0003-01 - Not found
> 0140-01 - Not found
> 0141-01 - Not found
> 0142-01 - Not found
> 0170-03 - Not found
> 0181-01 - Not found
> 0182-04 - Not found
> 0186-06 - Not found
> 0186-08 - Not found
> 0550-01 - Not found
>
> Notice that the code 0003-01 is one code that is in my arrasy, but the 
> function do not found it.
>
> Could anyone help me in this, please?
>
> Thanks a lot. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux