FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » array search part 2
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: array search part 2 [message #183757 is a reply to message #183752] Mon, 18 November 2013 15:05 Go to previous messageGo to previous message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma:
Senior Member
In article <93xuovoqvo59(dot)1wcgm8i5gn2hb$(dot)dlg(at)40tude(dot)net>, richard
<noreply(at)example(dot)com> wrote:

> I am attempting to search the array for matching entries.
> All matches, not just the first.
> While the code works fine, the result is not what I want.
> $btrack should return the value of six0[$track][0].
> Instead, the result shows the array key number.
> Even if I change the [0] to [1].
> Why?

For the 17 billionth time, you thick dope, you have used = instead of ==

> <?php
>
> $track=$_GET['item'];
> echo $track;
>
> $flip=$six0[$track][1];
> echo $flip;
> echo "<br>";
>
> $max=count($six0);
>
> $arow=0;
>
> while ($max>$arow){
>
> $btrack=$six0[$arow][0];
> if ($btrack=$track){echo $btrack;}
> $arow++;
> }
>
>
> ?>

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: searching an array
Next Topic: Perform maths based on a number in a text file
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 00:52:27 GMT 2024

Total time taken to generate the page: 0.18698 seconds