As part of a project I’m building, I allow my users to “tag” their links with keywords. I take the input as a comma separated string from a text input, split the tags at the comments, trim the whitespace
and insert them into a tag table, which has an auto-incremented tagid #, and then placing the auto-incremented tagid back in the links table, (hopefully comma-seprated).
everything up to generating that comma separated string of tag id#s is working, my tags are being put in the table correctly, and I’m not getting duplicates, (which is what this whole mess is supposed to prevent)
What follows is my code that’s attempting to take those “tags” and get the “tagid” number associated with it, place it in an array, and then generate a comma delineated string that’s placed into the user_content table.
The error I’m getting is
Warning: implode() [function.implode]: Invalid arguments passed in /var/www/public_html/testsite/submitlinks.php on line 47
foreach ($tagparts as $querytag) {
trim($querytag);
$query2 = "SELECT tagid from $uTagTable where tag='$querytag'";
$result2 = mysql_query($query2);
while ($row2 = mysql_fetch_array($result2)){
$tagid = $row2['tagid'];
echo "<p class=\\"error\\">tagid: $tagid</p>";
//--> this is line 47 implode(",",$tagid);
mysql_query("INSERT INTO user_links (tags) VALUES ('$tagid') WHERE url = '$link3'");
}
}
I should point out that I’ve added the echo statement, to make sure the correct data is being output from the $tagid = $row2[‘tagid’] and it is, I get a series of paragraphs with the correct tagid#s in them.
And, just for clarification, I’m not commenting out line 47 in my production code, just pointing out where my error is being “encountered”