tidak bisa insert data ke database melalui hosting gratis yaitu 000webhost

<?php
$koneksi = mysqli_connect("localhost","id14651187_fahmi","w+RT4vje]BVEvPx]","id14651187_scrim");
if (isset($_POST["submit"])) {

$nama = htmlspecialchars($_POST["nama"]);
$email = htmlspecialchars($_POST["email"]);
$clan1 = htmlspecialchars($_POST["clan1"]);
$clan2 = htmlspecialchars($_POST["clan2"]);
$query = "INSERT INTO daftar
	VALUES
	('','$nama','$email','$clan1','$clan2')
";
mysqli_query($koneksi, $query);

if (mysqli_affected_rows($koneksi) == 1) {
	echo "
		<script>
		alert('data berhasil');
		document.location.href = 'nyoba.php'
		</script>
	";
}else{
	echo "<script>
		alert('data gagal');
		</script>";
}
}
 ?>

<!DOCTYPE html>
<html>
<head>
	<title>login</title>
	<link rel="stylesheet" type="text/css" href="log.css">
</head>
<body>

<form method="post">
<div class="conten"><center>
	<div class="pusat">
		<div class="nav">
			<h1>nobit official</h1>
			<img src="nobit.jpeg" class="logo1">
		</div>
		<div class="uud">
			<table>
				<tr>
					<td>
						nama
					</td>
				</tr>
				<tr>
					<td>
						<input type="text" name="nama" id="nama" autocomplete="on" placeholder="masukan nama" class="pan">
					</td>
				</tr>
				<tr>
					<td>
						email
					</td>
				</tr>
				<tr>
					<td>
						<input type="text" name="email" id="email" placeholder="masukan email" class="pun">
					</td>
				</tr>
				<tr>
					<td>nama clan</td>
				</tr>
				<tr>
					<td>
						<input type="text" name="clan1" id="clan1" placeholder="nama clan" class="pun">
					</td>
				</tr>
				<tr>
					<td>nama clan 2</td>
				</tr>
				<tr>
					<td>
						<input type="text" name="clan2" id="clan2" placeholder="nama clan2" class="pun">
					</td>
				</tr>
				<tr>
					<td>
						<button type="submit" name="submit">kirim</button>
					</td>
				</tr>
			</table>

		</div>
	</div></center>
</div></form>
<h2>"web dalam pengembangan"</h2>
</body>
</html>
avatar fahmijha12
@fahmijha12

1 Kontribusi 0 Poin

Diperbarui 4 tahun yang lalu

2 Jawaban:

<div>mysqli_connect udah bener kelihatannya, cuma post nya gak tau. Aku gak ngelihat alamat post nya disitu.<br>Mungkin dicoba aja langsung eksekusi script mysqlnya langsung, gak pake form2 an gitu.</div>

avatar ChronoJava
@ChronoJava

41 Kontribusi 23 Poin

Dipost 4 tahun yang lalu

<div>$query = mysqli_quert($conn, "INSERT INTO daftar VALUES('','$nama','$email','$clan1','$clan2')</div>

avatar taintle
@taintle

1 Kontribusi 0 Poin

Dipost 4 tahun yang lalu

Login untuk ikut Jawaban