Can't select db using php

Avatar
  • Answered
I wrote the following test php script which looks almost exactly like the tutorial but it keeps saying that it can't select the database. I check the db name and made sure it matched. What could be the problem?
Avatar
Scott
Hello reversemix, I tested the exact code on my own server and was able to get in just fine. I then created a test user on your account, attached it to a database, and created a database connection script file. It also worked. My guess is that there is something incorrect in the variables. Be sure that the datbase name includes your cpanel username as a prefix. For example, if your username for cPanel is userna5 and the database name is testdb, then the $curr_db variable in the script must be named userna5_testdb. Altering the database name from that standard configuration did cause me to get the error you mentioned. Best Regards, Scott M