On Tuesday 26 November 2002 14:51, Jef wrote:
> I am having difficulty with the implode function. What I am doing is
> building a string for an UPDATE SQL command. At the end of the building
> portion of the code, I want to insert a comma between the various fields
> that will be updated. However, it is not working. Here is a portion of my
> code...thanks, in advance for any assistance received....
>
> $sqlUpdate = "SET ";
> if($image11_name != '') $sqlUpdate .= "image11='$image11_name'";
> if($image12_name != '') $sqlUpdate .= "image12='$image12_name'";
> if($textfield11 != '') $sqlUpdate .= "textfield11='$textfield11'";
> if($textfield12 != '') $sqlUpdate .= "textfield12='$textfield12'";
> if($textlink11 != '') $sqlUpdate .= "textlink11='$textlink11'";
> if($textlink12 != '') $sqlUpdate .= "textlink12='$textlink12'";
>
> $update = implode(",", $sqlUpdate);
> $sql = "UPDATE mp " .$sqlUpdate;
>
> I get a bad parameter message on the line with the call to the Implode
> function.
implode() expects an array as the second argument. You're passing a string. In
fact with the code you have above I don't see why you don't just tack the
comma on the end in the first place:
if($image11_name != '') $sqlUpdate .= "image11='$image11_name', ";
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Better tried by twelve than carried by six.
-- Jeff Cooper
*/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php