public function create() {
global $database;
$attributes = $this->sanitized_attributes();
$sql = "INSERT INTO ".self::$table_name." (";
$sql .= join(", ", array_keys($attributes));
$sql .= ") VALUES ('";
$sql .= join("', '", array_values($attributes));
$sql .= "')";
if($database->query($sql)) {
$this->id = $database->insert_id();
return true;
} else {
return false;
}
}
i can't seem to get this function to work, what i want to do is get the data from the form, clean it and add, my description from(_POST) and title from _POST as well and write it to a table. or if there is a better way of getting a data from a form, in my case image gallery. how do i write the sql statement. i have also tried this
$sql ='INSERT INTO photographgallery '.' (filename,type,size,description,title)';
$sql .='VALUES (\''.$filename.'\', \''.$type.'\',\''.$size.'\',\''.$description.'\',\''.$title.'\')';
which didn't work for me. HELP