Depends what you mean by "affordable". Prices start at around CHF 100, but, if there is a major event in the city that can go up a lot.
The tourist board website is: http://www.basel.com/en this lets you search for hotels in all price ranges.
For hotels at the station (Basel SBB, Basel has 2 "main" stations), I would try hotel Victoria and the St Gotthard, but you pay more for being near the station.
Cheapest "real" hotel (excluding youth hostels etc.) Ibis budget Basel City, "from" CHF 89. This is not far from the station, backing onto the tracks!
All hotels in Basel give free public transport tickets for the city (tram+bus) for the duration of your stay, so getting around is no problem.
Do not be tempted to get a taxi from the airport to your hotel, that will cost CHF 30-40. The ticket for the bus from the airport (2 zone ticket, CHF 4.40) includes buses or trams to anywhere in Basel city, you do not have to pay again.