Re: implode()
| From: | Jef | Date: | Tue, 26 Nov 2002 18:57:34 +0000 |
| Subject: | Re: implode() | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-126147@lists.php.net to get a copy of this message | ||
> > > 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', ";
> >
> > The reason being the comma at the end of the SQL command will prevent
the
> > command from working because SQL will expect another entry. However,
your
> > comment about implode expecting an array helps out. Thanks.
>
> Yes, but as you're building up the SQL statement manually you just leave
out
> the comma off the last line!
>
> Using implode() is appropriate if you're programatically (sp?) building an
SQL
> statement using an array.
The problem is I don't know which will be the last element in the string. I
am allowing 9 images to be changed, 9 text labels to be changed, and 9 links
to be changed. I don't know which will be the last. I'm using an update sql
command to change the database when these changes are being made.
When I set the $sqlUpdate to be an array the printed result is ARRAY. When I
print the sql command it reads "UPDATE mp SET ARRAY". What am I doing wrong?
Jef