Re: $pieces = explode(",", $_POST["fieldtype1"]);
| From: | Richard Lynch | Date: | Wed, 09 Nov 2005 08:08:08 +0000 |
| Subject: | Re: $pieces = explode(",", $_POST["fieldtype1"]); | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-225419@lists.php.net to get a copy of this message | ||
On Mon, November 7, 2005 11:00 pm, John Taylor-Johnston wrote:
> $pieces = explode(",", $_POST["fieldtype1"]);
>
> What is a way to echo each pieces[x] separately so I can echo them
> like
> this:
>
> while(x=0 to xMax)
> {
> $sql .= "
".$pieces[x]." \r\n";
> }
foreach ($pieces as $piece){
$sql .= "'$piece'\r\n";
}
Though you probably don't really want the \r\n in there...
But you may find this even easier:
$pieces_sql = implode("', '", $pieces);
$sql .= "'$pieces_sql'";
In between explode($_POST) and whatever you do, you REALLY ought to
call mysql_real_escape_string on each $pieces element.
--
Like Music?
http://l-i-e.com/artists.htm