Jump to content

Problem with the implode function.


pthurmond

Recommended Posts

Hey everyone. I am having a weird error with the implode function. I have used it dozens of times, but this time it doesn't want to work.

Here is the error:
[quote]
Warning: implode(): Bad arguments. in /home/content/p/a/l/paldata/html/TeamB/user_volunteer_edit.php on line 90
[/quote]

Here is the code:
[code]
$query = "SELECT Activity_ID FROM Activity_List WHERE Volunteer_ID = '$vid'";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());

if($result)
{
$i = 0;

while($row = mysql_fetch_array($result, MYSQL_BOTH))
{
$acts[$i] = $row[0];
$i++;
}

$acts = implode(",", $acts);
}
[/code]


I have tried it with single quotations first with no luck and originally I was referring to the array with $acts[] in the while loop.
Any ideas?

Thanks,
Patrick
Link to comment
https://forums.phpfreaks.com/topic/29288-problem-with-the-implode-function/
Share on other sites

Because I am having trouble passing an array to a function. Of course you have a point, but this is slightly easier to code.
None the less, I would like to know why this is giving me issues. If nothing else but to learn from my mistakes.

Archived

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

×
×
  • Create New...

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.