mysqli_query() expects at least 2 parameters, 1 given

mau nannya gan

= 1) { echo "login berhasil"; }else { echo "login gagal"; } } } ?>

avatar rianrifai
@rianrifai

2 Kontribusi 0 Poin

Diperbarui 4 tahun yang lalu

2 Jawaban:

<pre> &lt;?php if (isset($_POST)) { $user = $_POST['user']; $pass = $_POST['pass']; $login = $_POST['login']; }

if (empty($user) and empty($pass)) { ?&gt; &lt;script type="text/javascript"&gt; alert("username /password tidak boleh kosong"); &lt;/script&gt; &lt;?php } else {$koneksi = mysqli_connect($uname, $paswd, $db); ($sql = mysqli_query( $koneksi, "select * form tb_login where username = '$user' and password = md5('$pass')" )) or die(mysqli_error()); $data = mysqli_fetch_array($sql); $cek = mysqli_num_rows($sql); if ($cek &gt;= 1) { echo "login berhasil"; } else { throw new Exception("login gagal"); }} ?&gt; </pre>

avatar marilynbathory
@marilynbathory

61 Kontribusi 9 Poin

Dipost 4 tahun yang lalu

masi eror gan Notice: Undefined variable: username in C:\xampp\htdocs\web\login.php on line 85

Warning: mysqli_connect() expects parameter 3 to be string, object given in C:\xampp\htdocs\web\login.php on line 85

Warning: mysqli_query() expects parameter 1 to be mysqli, null given in C:\xampp\htdocs\web\login.php on line 88

Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\xampp\htdocs\web\login.php on line 89

avatar rianrifai
@rianrifai

2 Kontribusi 0 Poin

Dipost 4 tahun yang lalu

Login untuk ikut Jawaban