|
Posted by James Benson on 07/21/05 18:02
Thanks for all your help, ive got it working as i needed, my db query is
built like this, works but probably not the best way of doing it:-
$sqlStart = "INSERT INTO `tester` (";
$sqlMiddle = ") VALUES (";
$sqlEnd = ")";
$keys = array();
$values = array();
foreach($formData as $keyName => $keyValue){
array_push($keys, "`$keyName`");
array_push($values, "'$keyValue'");
}
$keys = implode(",", $keys);
$values = implode(",", $values);
$query = "$sqlStart$keys$sqlMiddle$values$sqlEnd";
$result = mysql_query($query);
Navigation:
[Reply to this message]
|