I have a site that is working on a hosted server. I setup PHP, MYSQL, and IIS on my local server. PHPMYADMIN works so I know that php is working. Im not that great at coding, and I keep getting errors at every turn. The hosted version of PHP that works is 5.6.-29, and the only version I could obtain was 5.6.30.
So I changed it to mysqli, then I got an error about mysql_select, so I changed it to mysqli_select and now im getting
What is confusing is that this test DB script works with mysql_connect just fine.
Here is my original connection code...
* Gets default mysql connection
*
* @param void
*
* @return resource
*/
public static function getDbConn($dbParams = null) {
if ($dbParams !== null) {
$host = $cfg['host'];
$username = $cfg['username'];
$password = $cfg['password'];
$dbName = $cfg['dbName'];
} else {
if (self::$_conn) {
return self::$_conn;
}
$host = SPC_DB_HOST;
$username = SPC_DB_USERNAME;
$password = SPC_DB_PASSWORD;
$dbName = SPC_DB_DBNAME;
}
self::$_conn = mysqli_connect($host, $username, $password);
mysqli_select_db($dbName);
return self::$_conn;
}