When upgrading your walls, you can choose to upgrade each wall, or upgrade the row. A row is actually any chunk of walls that are connected. Once you choose this, you will have a screen pop up with 2 options and the information about what changes as you upgrade. (See attached image).
Upgrade Option 1
This will show you how many of the walls that are in the row can be upgraded using the resources available. In the example, there are only enough resources to upgrade 5 out of the 239 selected.
Upgrade Option 2
This shows you the gold cost to upgrade the entire selection to the next level, or to upgrade them all the way to the current maximum level. In this example all the walls are level 10, so the price would be the same for both options. This will not always be the case in your own base.