Jump to content

Archived

This topic is now archived and is closed to further replies.

climbjm

[resolved] in_array() issues

Recommended Posts

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...
[code]
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);
}
[/code]

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

Share this post


Link to post
Share on other sites
You have a misplaced bracket:

[code] 
if (!in_array($temp_url,$urls_array))
  array_push($urls_array, $temp_url);[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.