Well there are a few simple ways to do this.
1 - When you press a direction key check the spot in the map array where you going to move the player and see if you can move there, if you can then move them.
example:
if(dbLeftKey()){
if(Map[pX-1][pY] == 0){ pX -= 1; }
}
Also you can store the players Old position in 2 variables OldX, OldY befor you move, check the tile the player is on, then if you cant move there set the position back to the old position.
example:
OldX = pX; OldY = pY;
if(dbLeftKey()){ pX -= 1; }
// other directions... //
if(Map[pX][pY] == 1){ pX = OldX; pY = OldY; }
Hope that helps.