Cześć. Wstawiłem stronę na serwer w domenie home. Niestety nie działa nic co związanego z bazą danych pomimo, że nie wywala błędu przy łączeniu. Na Xampie wszystko git działa
Oto moj plik index.php:
<html>
<meta charset="ISO 8859-2">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="style.css">
<body bgcolor="#FFCC4A" >
<center>
<div class="main">
Wyszukaj pytanie !
<form method="post">
<input type = "text" placeholder = " Search data" name = "search">
<button name = "submit" >Search</button>
</form>
</div>
<table>
<?php
$mysqli = new mysqli("localhost","nazwabazydanych","login","haslo","nazwatabeli");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if(isset($_POST['submit']))
{
if(!empty($_POST['search']))
{
$search = $_POST['search'];
$sql = "SELECT * FROM edu WHERE PYTANIE LIKE '%$search%' OR ODP LIKE '%$search%'";
$result = $mysqli->query($sql);
if($result){
if(mysqli_num_rows($result) > 0 ){
?>
<thead>
<tr>
<th class="text-left">PYTANIE</th>
<th class="text-right">ODPOWIEDŹ</th>
</tr>
</thead>
<?php
while($row = mysqli_fetch_assoc($result)){
$PYTANIE = $row['PYTANIE'];
$ODP = $row['ODP'];
?>
<tbody>
<tr>
<td class="text-left"><?php echo $PYTANIE?></td>
<td class="text-right"><?php echo $ODP?></td>
</tr>
</tbody>
<?php
}
}else{
echo '<h2> Data not found </h2>';
}
}
}
}
?>
</table>
</center>
</body>
</html>