I have a login script that used to read username/password variables in the file (defined in the file) but want to integrate it into a database. Only 1 username/password - not multiple. The username/password in the database is the only entry, so doesnt have to choose. I think it's an error with my mysql connection - it also doesnt like connecting to anything apart from localhost, is there a better connection string that the one im using? and am i definind the password/username from database correctly? i tried getting it from database before starting function and calling them $username1 etc, and then later in the case section putting var $username = $username1; because before that (when the username and password were edited in the file) it read var $username = 'test'; and the username was test, but putting = $username1 made an error, and '$username1' made it think the username WAS $username1, not the value i defined from database as $username1. All files are below, thanks in advance! Class file that is called to check authentication: Vars.php Database.php Thanks!
You're right: your problem is in your database connection. You need to change those variables values to the correspondig with your host. For example: $DBName = "Lotto"; $host = "sql.myhost.com"; // check this value with your hosting admin! $user = "bd_username"; // check this value with your hosting admin! $pass = "itisverysecret"; // check this value with your hosting admin! PHP: Hope that helps!