I need some help to insert comma separates strings in开发者_如何学Pythonto multiple columns into db.
My $_POST['search']
value output. [search] => schools,books,mobile
How do i make an foreach or for to insert those data into db? :S
You can use the explode function.
$queries=explode(',', $_POST['search']
Now $query
is an array containing the separated values. Then you do your query, but without further informations about that, I have to stop here.
$post = $_POST['search'];
$queries = explode( ',', $post );
foreach( $queries as $query ) {
$db->Execute("INSERT INTO tags SET name = '".$query."'");
}
This seems to worked for me..
I was using @klez's informations
精彩评论