Jump to content


Photo

[resolved] in_array() issues


  • Please log in to reply
2 replies to this topic

#1 climbjm

climbjm
  • Members
  • PipPipPip
  • Advanced Member
  • 32 posts
  • LocationSalt Lake City, UTAH

Posted 23 August 2006 - 08:31 AM

Does anyone see why this is not working?

I have an array of URLS.
I am also pulling urls froma database and merging them into the array, but I dont want duplicates.

This is the code I am using...
while($row = mysql_fetch_array($result))
{
   $temp_url = "".$row['url'];
   echo($temp_url);
   // this checks to make sure that the URL isn't already in the Array
   if (!in_array($temp_url),$urls_array)
      array_push($urls_array, $temp_url);
}

but I am getting this error:
Parse error: syntax error, unexpected ',' in /<mypath> /index.php on line <#>

~ climbjm

#2 448191

448191
  • Staff Alumni
  • Advanced Member
  • 3,545 posts
  • LocationNetherlands

Posted 23 August 2006 - 08:40 AM

You have a misplaced bracket:

   
if (!in_array($temp_url,$urls_array))
  array_push($urls_array, $temp_url);


#3 climbjm

climbjm
  • Members
  • PipPipPip
  • Advanced Member
  • 32 posts
  • LocationSalt Lake City, UTAH

Posted 23 August 2006 - 08:42 AM

Ah man, thanks....  I it's always the stupid stuff

~ climbjm




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users