joeros Posted June 15, 2010 Share Posted June 15, 2010 I need to be able to pass fieldnames and values in an array the decoding is done like this public function insert(array $values, $table) { if (count($values) < 0) return false; foreach($values as $field => $val) $values[$field] = $this->escapeString($val); i have tried passing the arrays like this $values = array ("'Joe', 'Timbs', '1985-12-12', 'f', '50'"); insert ($values,"people"); but i am not sure how to pass the fieldnames. Can anyone help Thanks to any replies Link to comment https://forums.phpfreaks.com/topic/204858-problem-using-arrays/ Share on other sites More sharing options...
DavidAM Posted June 15, 2010 Share Posted June 15, 2010 $values = array ('Field1' => 'Joe', 'Field2' => 'Timbs', 'Field3' => '1985-12-12', 'Field4' => 'f', 'Field5' => '50'); insert ($values,"people"); Link to comment https://forums.phpfreaks.com/topic/204858-problem-using-arrays/#findComment-1072428 Share on other sites More sharing options...
joeros Posted June 16, 2010 Author Share Posted June 16, 2010 @DavidAm Thanks SO much for that, surprising how easy it is when you know how Link to comment https://forums.phpfreaks.com/topic/204858-problem-using-arrays/#findComment-1072875 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.