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: solved [message #183791 is a reply to message #183780] Tue, 19 November 2013 16:43 Go to previous messageGo to previous message
Arno Welzel is currently offline  Arno Welzel
Messages: 317
Registered: October 2011
Karma:
Senior Member
Am 19.11.2013 03:45, schrieb richard:
> <?php
>
> $track=$_GET['item'];
>
>
> $asong=$six0[$track][0];
> $flip=$six0[$track][1];
>
> $max=count($six0);
>
> $match=0;
>
> for ($item=0;$item<=$max;$item++){
> if ($flip==$six0[$item]['0'])
> {if ($six0[$item][2]=$six0[$track][2])
> {$match=$item;}}
> }

PLEASE format your code properly!

for($item=0; $item <= $max; $item++)
{
if($flip == $six0[$item]['0'])
{
if($six0[$item][2] = $six0[$track][2])
{
$match = $item;
}
}
}

And why this?

if($six0[$item][2] = $six0[$track][2])

Please note: "=" is NOT the same as "=="!

If you want to COMPARE $six0[$item][2] and $six0[$track][2] you MUST write:

if($six0[$item][2] == $six0[$track][2])



--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
[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: Sat Nov 30 09:11:16 GMT 2024

Total time taken to generate the page: 0.05760 seconds