我写了一个php文件作为我项目的一部分。我使用xampp来模拟数据库并测试我的php。以下代码在xampp上运行完美,但在我托管数据的000webhost上运行不正常。凭证是可以的,因为它响应操作失败回声。此外,xampp和000webhost上的数据库也是精确副本。感谢。
<?php
$dbuser = "a7564419_giot";
$dbhost = "mysql11.000webhost.com";
$dbpass = "xxxx";
$dbname = "a7564419_giot";
//$dbuser = "root";
//$dbpass = "";
//$dbhost = "localhost";
//$dbname = "test_db";
$dberror = "Conncection failed!";
$conn = mysqli_connect($dbhost, $dbuser, $dbpass,$dbname) or die($dberror);
//$url = $_GET['url'];
//$url = (int)$url;
//$name = $_GET['Username'];
//$pass = $_GET['Password'];
//$add = $_GET['Address'];
//$Dev1 = (int)$_GET['Device1'];
//$Dev2 = (int)$_GET['Device2'];
//$Dev3 = (int)$_GET['Device3'];
//$Dev4 = (int)$_GET['Device4'];
$query = "INSERT INTO 'users' (un, pw) VALUES ('manav1', 'abc')";
$result = mysqli_query($conn, $query) OR die("Operation Failed!!");
mysqli_close($conn);
?>