pthurmond Posted December 3, 2006 Share Posted December 3, 2006 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 More sharing options...
chiprivers Posted December 3, 2006 Share Posted December 3, 2006 What exactly are you trying to do here? Why put the values into an array if you are going to take them out again into a string? Why not just build a string in the first place? Link to comment https://forums.phpfreaks.com/topic/29288-problem-with-the-implode-function/#findComment-134245 Share on other sites More sharing options...
pthurmond Posted December 3, 2006 Author Share Posted December 3, 2006 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. Link to comment https://forums.phpfreaks.com/topic/29288-problem-with-the-implode-function/#findComment-134252 Share on other sites More sharing options...
JasonLewis Posted December 3, 2006 Share Posted December 3, 2006 well from what i can gather $acts has nothing in it. try doing print_r($acts) and see whats in there. Link to comment https://forums.phpfreaks.com/topic/29288-problem-with-the-implode-function/#findComment-134256 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.