I have an array of variables:
$values = array($a,$b,$c);
i want to pass this array through this function:
function db_insert($table, $attributes, $values)//insert into the database
{
// $values and takes an array of variables. $attributes is a string "att1, att2,...."
$result = mysql_query("INSERT INTO ' '".$table."' ( '".$attributes."' ) VALUES ( '".implode("','", $values)."' )");
return $result;
}
I pass it like this but it doesn't work:
db_insert("table","a,b,c",$values);
There is no errors but the record is not stored into the database. What is the problem?