I recently decided to get my final project from last year online. But I ran into a lot of trouble. Can someone help me? I was using the functions in last year's CS50 finance to connect php to mysql db, but I just cannot get it right. I'm guessing its here that went wrong:

> $handle = new
> PDO("mysql:dbname=coursentnu;host=;port=????", "????", "????");

(I changed port, username, and password to stars for safety) I can't figure out what went wrong. I have a sql db named coursentnu set up. But it just won't work. If I try print_r(query(...));, it's just blank. Please help!

  • Ah! Sorry, I already resolve this question and posted it on Facebook Group CS50. I'll repost the answer below right away.
    – RexYuan
    Jan 15, 2015 at 9:30

1 Answer 1


So the problem, it turns out, is the dots. Somehow having dots (i.d. ".") in that will mess the whole thing up. If you store that IP (in my case, in a variable then use that inside the PDO, it works. Idk exactly why, but it works. Hope someone here can be kind enough to elaborate?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .