how to insert multiple php array values into mysql for the same table? -
hi new php , having 3 php arrays namely bookname, bookprice , bookisbn, need insert values like
"bookisbn" "bookname" "bookprice"
mysql
eg:
isbn1 bookname1 bookprice1 isbn2 bookname2 bookprice2 isbn3 bookname3 bookprice3
as of tried iterate 3 arrays like,
foreach($booknamearray $bookname && $bookpricearray $bookprice && $bookisbnarray $bookisbn) { .. }
and
while($booknamearray $bookname && $bookpricearray $bookprice && $bookisbnarray $bookisbn){ .. }
nothing worked me, please kindly me out achieve this.
thanks in advance, naveen.
assuming have same number of elements, can use loop, , make string of values:
for($i = 0; $i < count($booknamearray); $i++) { $str = $booknamearray[$i] . " " . $bookpricearray[$i] . " " . $bookisbnarray[$i]; //insert $str db }
Comments
Post a Comment