Actually, integers should not be given quotes and don't need to be run through sql_escape. The following is sufficient:

```
WHERE user_id = " . (int) $row['user_id'];
```