Witam
Mam sobie taki kod:
<?php
require_once("config.php");
if(isset($_POST['register'])){
$email = '[email protected]'; //trim($_POST['email']);
$password = trim($_POST['password']);
$hashPassword = password_hash($password,PASSWORD_BCRYPT);
$query = "SELECT email FROM user WHERE email='$email'";
if ($result = mysqli_query($db,$query)) {
$wiersze = mysqli_num_rows($result);
if ($wiersze > 0)
{
while ($row = $result->fetch_assoc()) {
$wynik = $row["email"];
}
echo 'jest';
echo '<br>wiersze = ' . $wiersze . 'email = '.$wynik['email'];
}
else
{
echo '<br>wiersze = ' . $wiersze;
echo ' nie ma ';
}
} else {
echo 'blad zapytania';
}
}
?>
<h1>Formularz rejestracyjny</h1>
<form method="post">
<input type="text" name="email" placeholder="Email">
<input type="password" name="password" placeholder="Password">
<button type="submit" name="register">Zarejestruj</button>
</form>
Bazowałem na tym co napisali tutaj
Ale niestety wywala mi taki błąd:
Warning: mysqli_query() expects parameter 1 to be mysqli, object given in /var/www/vhosts/zmarekz.5v.pl/httpdocs/registration.php on line 14
blad zapytania
Co robię nie tak ? Proszę o pomoc.