I want to update a field. This the code I am using to write values in the database.
$enrollment = array( 'database' => 'enrollment', 'username' => 'postgres', 'password' => '', 'host' => 'localhost', 'driver' => 'pgsql', ); Database::addConnectionInfo('myid', 'default', $enrollment); db_set_active('enrollment'); db_update('student') ->fields(array('picture' => 'Yucks')) ->condition('studid', '101-03043', '=') ->execute(); db_set_active();
The code doesn’t work. Instead of saving values in the database, it throws an error.
What do I need to change in the code to make it work?
Sponsored by SupremePR