recorrer un data table para obtener datos he insertar en BD
recorrer un data table para obtener datos he insertar en BD
gabcontreras42
Posts: 2Questions: 1Answers: 0
hola compañeros como puedo hacer para recorrer los rows de un datatable para luego insertarlos en una table detalle, la idea es poder hacer una especie factura que cuando se ingresen los productos, estos se listen en el datatable y luego insertar esos registros en una tabla detalle en la base de datos Mysql
soy nuevo en programación actualmente estoy intentando hacerlo con php javascript y mysql, agradezco mucho alguna guía por donde comenzar muchas Gracias de Antemano.
Answers
You would need to send the data from the browser to a server-side script and upload into the database.
Another option would be to use Editor. This example (from this thread) manually copies records from one table to another - with both syncing to a database. You could have the second table not in the DOM, and still use the Editor API to copy selected records (or all records) into the database,
Colin
hi colin thanks for you comment , but i fill the data table manual mode whith inputs, when click a button insert data in the table,now i need understand how i can take every row of my datatable an insert in Mysql,
now i think use each(), but i dont how to use , can you help me ?
thank you so much
You can send the entire data table to the server. This is a button for that purpose that you can use with your data table.
On the server you can do this for example:
That shoud give you an array of all of your table rows which you can loop through and INSERT them into your database table.