You are here: Re: multidimensional array in to a MySQL table « PHP Programming Language « IT news, forums, messages
Re: multidimensional array in to a MySQL table

Posted by Richard Levasseur on 03/14/06 10:36

Its not, really, its in $table[$row][$col] = $value format, at least if
i understand his post correctly. It also sounds like an interation
problem? I can't rightly tell if its trouble getting the last key from
table ( $row from $table ) or last key from row ($col from each $row).

In either case:

$i = 0; to $i < n, iterates n times. Make sure you're iterating to the
correct amount

foreach($table as $row) {
$columns = implode(... array_keys($row));
$values = implode(... array_values($row));
$query = "insert into table ($columsn) values ($values)";
}

or

foreach($table as $row) {
"insert into table (col1, col2, ...) values ($row[level1], $row[level2]
....)";
}

Hope that helps?

 

Navigation:

[Reply to this 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

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