For a project, I'm trying to make an application where users can enter their values, but when I test it on localhost I keep getting this error: warning: mysqli_connect(): (HY000/ 3159): Disable transmission when using an insecure connection --require_secure_transport=ON. This is my php code:
$bedrijfsnaam = $_POST['bedrijfsnaam']; $dag = $_POST['dag']; $caption = $_POST['caption']; var_dump($bedrijfsnaam, $dag, $caption); $dbh = mysqli_connect(hostname: $host, username: $username, password: $password, database: $dbname); if (mysqli_connect_errno()) { die("Connection error: " . mysqli_connect_errno()); } $sql = "INSERT INTO file_upload (bedrijfsnaam, dag, caption) VALUES (?, ?, ?)"; $stmt = mysqli_stmt_init($conn);
Is there a secure way to fix this error since the project must be released and from what I understand it is not safe to turn off secure_transport.
I tried using another external database, which resulted in another error, the connection was actively refused. This code does work because I tried running it on localhost and it does work
You need to call [mysqli_real_connect][1] and pass in the $mysqli instance as a parameter
Then passed to mysqli_real_connect