I injured my knee playing basketball six weeks ago and it still hurts. It gives out occasionally and feels stiff. What's wrong?

Internal derangment! I would see a joint specialist, either a rheumatologist or orthopedic surgeon. I do not know your injury details, which would be of help. You could have a meniscal injury, sprained your medial and lateral collaterasl ligaments or have a tear either partial or complete of your cruciates. Milder possibilities: bursitis, plica, tendinitis. Hope its one of these. You may need an MRI to diagnose it.
See an ortho doc. Based on the info provided, you need to see an orthopedic surgeon. The possibilities include an acl injury or a meniscus. The stiffness is likely from an effusion, fluid within the knee. An effusion is a marker of injury within the knee. Instability symptoms after an injury is a worrisome complaint. The bottom line is you gotta get it checked out.