on-internet
← Community

Php Mysql Insert Array in columns [duplicate]

Stack Overflow ·

I have the follow problem: I have differents arrays, each array contain a list of items. I try to insert in database but each item of list result togheter. This is my code: (I use preg_replace to delete <br> between items) $codice = preg_replace('/(<br>)+$/', '', $_POST['jcitemcodice']); $prodotto = preg_replace('/(<br>)+$/', '', $_POST['jcitemname']); $quantita = preg_replace('/(<br>)+$/', '', $_POST['jcitemqty']); $prezzo = preg_replace('/(<br>)+$/', '', $_POST['jcitemprezzo']); $a1 = array("$codice","$prodotto","$quantita","$prezzo"); $res = implode("','" ,$a1); $sql = "INSERT INTO test (co

Comments

Sign in or sign up to comment and upvote.

No comments yet.