0
Warning: mysqli_query() expects at least 2 parameters, 1 given in /storage/emulated/legacy/htdocs/new/home.php on line 15.
Can someone help me fix this urgently
4 Respostas
+ 5
Well that's odd, I did a recheck just now, and see that it is how it is done using mysqli. You can check it out on w3schools:
https://www.w3schools.com/php/func_mysqli_fetch_row.asp
The example there is my reference, I don't know why it doesn't recognize mysqli_fetch_row, have you verified the PHP version and mysqli module?
+ 4
Replace the line where it says:
while($rows = mysqli_query($result)) {
With this, I strongly believe this is what you meant to do:
while ($rows=mysqli_fetch_row($result)) {
It is the explanation for the error message, you wanted to use mysqli_fetch_row(), which requires one argument, but mistakenly type mysqli_query() instead, which, as you have used previously, requires two arguments :)
Hth, cmiiw
0
This the code to it
<?php
session_start();
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
$username = $_SESSION['username'];
include("connect.php");
$result = mysqli_query($conn,"select
users.last_name,
users.first_name,
users.phone,
from users where username='$username'");
while($rows = mysqli_query($result)) {
$user_fullname = $rows['first_name'].' '.$rows['last_name'];
$phone = $rows['phone'];
}
?>
<html>
<body>
Welcome <?php echo $_SESSION['username']; ?>,
<a href="logout.php">logout</a>
</body>
</html>
0
It's still not working. this is the result
Fatal error: Call to undefined function mysqli_fetch_row() in /storage/emulated/legacy/htdocs/new/home.php on line 15