1 回答

TA貢獻(xiàn)1828條經(jīng)驗(yàn) 獲得超6個(gè)贊
這并不完美,但它向您展示了它是如何完成的。mysli connct 只有 4 個(gè)參數(shù)。如示例所示。
當(dāng)然,只有當(dāng)所有參數(shù)數(shù)據(jù)庫名稱、主機(jī)名 muserna 和密碼都正確時(shí),它才會(huì)打開。
特別是在探索和開發(fā)過程中,您必須啟用錯(cuò)誤報(bào)告。這樣您就可以檢查并消除發(fā)生的錯(cuò)誤。
<!DOCTYPE html>
<html>
<body>
<form method="post" action="new.php">
A : <input type="text" name="X1" placeholder="Enter username" /><br />
B : <input type="text" name="X2" placeholder="Enter password" /><br />
C : <input type="text" name="Y1" placeholder="Enter C" /><br />
D : <input type="text" name="Y2" placeholder="Enter D" /><br />
<br></br>
<input type="submit" name="SubmitButton" value="Submit" />
</form>
</body>
</html>
<?php
if(isset($_POST['SubmitButton'])){
$dbhost = "db1109865_hf";
$dbname = "abc";
$username = $_POST['X1'];
$password = $_POST['X1'];
$Y1 = = $_POST['Y1'];
$Y2 = = $_POST['Y2'];
$link= new mysqli($dbhostT, $username, $password, $dbname;
if (!$link) {
echo "error connecting." . PHP_EOL;
echo "Debug-errrorummer: " . mysqli_connect_errno() . PHP_EOL;
echo "Debug-error message: " . mysqli_connect_error() . PHP_EOL;
exit;
}
echo "connected";
}
?>
- 1 回答
- 0 關(guān)注
- 135 瀏覽
添加回答
舉報(bào)