how to create membership conditional output

i have 2 membership levels on my site: Basic & Premium

I'd like to code a conditional output based on the user's membership level so that the following output occurs:

Basic Membership:

Premium Membership:

how can i code a membership-conditional statement to add on "?discount=XXXX" to the end of the link?

(i have phpsnippets installed and can use php code within the post content)