Re: array_search and in_array
| From: | Jo�o C�ndido de Souza Neto | Date: | Wed, 12 Jul 2006 13:15:40 +0000 |
| Subject: | Re: array_search and in_array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-239339@lists.php.net to get a copy of this message | ||
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@curitibaonline.com.br> escreveu na
mensagem news:57.00.55355.58AE4B44@pb1.pair.com...
> 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.