01.
02.
$objConnect
= mysql_connect(
"localhost"
,
"root"
,
"root"
)
or
die
(mysql_error());
03.
$objDB
= mysql_select_db(
"mydatabase"
);
04.
$i
= 0;
05.
foreach
(
$namedDataArray
as
$result
) {
06.
$i
++;
07.
$strSQL
=
""
;
08.
$strSQL
.=
"INSERT INTO customer "
;
09.
$strSQL
.=
"(CustomerID,Name,Email,CountryCode,Budget,Used) "
;
10.
$strSQL
.=
"VALUES "
;
11.
$strSQL
.=
"('"
.
$result
[
"CustomerID"
].
"','"
.
$result
[
"Name"
].
"' "
;
12.
$strSQL
.=
",'"
.
$result
[
"Email"
].
"','"
.
$result
[
"CountryCode"
].
"' "
;
13.
$strSQL
.=
",'"
.
$result
[
"Budget"
].
"','"
.
$result
[
"Used"
].
"') "
;
14.
mysql_query(
$strSQL
)
or
die
(mysql_error());
15.
echo
"Row $i Inserted...<br>"
;
16.
}
17.
mysql_close(
$objConnect
);