[eluser]AndrewTurner[/eluser]
[quote author="bretticus" date="1279819150"]Once the data is posted, it's a native PHP array and you'd handle it the same as any other typical array. No magic needed really. For example:
Code:
<?php
$sql = "INSERT INTO mytable (myvalue) VALUES ";
$sql .= "('" . implode("'),('", $_POST['product-sides']) . "')";
// ci query call.
$this->db->query($sql);
?>
I'm using an implode to facilitate multi-row insert syntax in MySQL. I could have used a foreach to create separate insert statements however. Note: this is sample code and whether it works depends on what you have. As for suggestions on which code to post, you might try the code you are struggling with. :-)[/quote]
The only code really I was having problems with was a method as to how to run through the array and so on, I've been working at it for days and funnily enough it just never came to mind
Thanks for you're help, So far with the code and a few minor changes to modify it to a foreach loop it seems to be working as planned, so thanks there.
[quote author="Phil Sturgeon" date="1279819400"]MySQL injecterific.[/quote]
[quote author="bretticus" date="1279819495"][quote author="Phil Sturgeon" date="1279819400"]MySQL injecterific.[/quote]
Well sure, besides all the security vulnerabilities imposed by my example, it is just an example.
[/quote]
Agree, I might be silly, but not silly enough to leave it as is with the example. I'll modify and chop and change it around. Once It's using CI's db classes for the input, I'll post up the results.