I learned that in school too! But I don’t think many people actually follow that rule (which means it isn’t much of a rule).
The Chicago Manual of Style, usually a pretty strong authority on questions like this, not only does not have this rule; it actually endorses not capitalizing “president” even when it is used an official title before the president’s name, as in president George W. Bush. I haven’t found a lot of people doing this in practice though.
By contrast, AP style is what Martin Beckett suggests: capitalize only when the official title precedes the name. President Clinton has served as president since 1993. This style seems most common in practice.
Some writers, maybe 5% to 10%, follow the rule you described.
The question of which is correct ultimately hangs on what you mean by correct. This is one of the questions where there is no strong consensus. There is no ultimate authority, no Supreme Court of Capitalization, to settle the issue.
However there is a consensus on one point: in sentences like Thank you for joining us, Mr. President, it seems President is always capitalized.