erdinc
05-21-2006, 02:40 AM
Hi
I'm looking for a way to create INSERT statements for mysql using values stored in an array and I'm not sure how to go about with this. In theory I would like to use:
<?php
foreach($_POST as $key => $item) {
$key = $_POST[$key];
}
?>
to convert the posted vars to simplified variables. I would then like to be able to put them into an array and use it to to create the SQL statements (eg. INSERT statement).
I want to achieve this because the number of form fields may vary and i wouldn't want to type in all the fields and variables inside the INSERT statment.
I hope i've explained what i want to do clearly and would welcome any help on this.
Thanks
Erdinc
I'm looking for a way to create INSERT statements for mysql using values stored in an array and I'm not sure how to go about with this. In theory I would like to use:
<?php
foreach($_POST as $key => $item) {
$key = $_POST[$key];
}
?>
to convert the posted vars to simplified variables. I would then like to be able to put them into an array and use it to to create the SQL statements (eg. INSERT statement).
I want to achieve this because the number of form fields may vary and i wouldn't want to type in all the fields and variables inside the INSERT statment.
I hope i've explained what i want to do clearly and would welcome any help on this.
Thanks
Erdinc