Reply to Re: [PHP] $pieces = explode(",", $_POST["fieldtype1"]);

Your name:

Reply:


Posted by "Richard Lynch" on 10/21/88 11:31

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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация