I'm using a PSQL database with PHP to do an update query. I have to check if the query was successful or not. I tried the MySQL 'version' like this but it doesn't work and I always get the echo 'error';
:
public function update_user($psql, $data) {
$update = pg_fetch_all(pg_query_params($psql, "UPDATE users SET first_name = $1, last_name = $2, email = $3 WHERE id = $4", array($data['first_name'], $data['last_name'], $data['email'], $data['user_id'])));
if ($update) {
echo 'succes';
}
else {
echo 'error';
}
}