6pandn21 Posted April 15, 2010 Share Posted April 15, 2010 Hello everyone, I am building a simple shopping cart but my knowledge is somewhat limited in this area. So I have a query string for storing three different data; items_name, amount and price. $name_items_query_string .= '&item_name_' . $database_count . '=' . $item['name']; $price_items_query_string .= '&amount_' . $database_count . '=' . $item['price']; $qty_items_query_string .= '&quantity_' . $database_count . '=' . $item['qty']; So these string contains multiple items which I need to insert to my database table but I really have no knowledge unfortunately. I am thinking maybe I will need to explode the array and store them as comma separated file but that's just a shot in the dark. If anyone could show me some directions; like a tutorial or an example, it would be great. Thank you. Link to comment https://forums.phpfreaks.com/topic/198604-inserting-multiple-items-to-the-database-from-an-array/ Share on other sites More sharing options...
Ken2k7 Posted April 15, 2010 Share Posted April 15, 2010 I don't quite understand. Can you post up a few example data? Link to comment https://forums.phpfreaks.com/topic/198604-inserting-multiple-items-to-the-database-from-an-array/#findComment-1042183 Share on other sites More sharing options...
6pandn21 Posted April 15, 2010 Author Share Posted April 15, 2010 I don't quite understand. Can you post up a few example data? An example data would be a shopping cart with item amount price pants 12 20 shirts 14 25 The actual string when echoed out is something like this; item id, item name, item price. (I left printing out the amount) &item_name_1=Baseball Mitt&item_name_2=Soccer Ball&item_name_3=Hockey Stick &amount_1=19.50&amount_2=25.00&amount_3=33.25 I hope that's what you were asking about. Link to comment https://forums.phpfreaks.com/topic/198604-inserting-multiple-items-to-the-database-from-an-array/#findComment-1042407 Share on other sites More sharing options...
Ken2k7 Posted April 15, 2010 Share Posted April 15, 2010 Uh... is that a query string, as in the URL? Link to comment https://forums.phpfreaks.com/topic/198604-inserting-multiple-items-to-the-database-from-an-array/#findComment-1042410 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.