0

The query is simple -> "SELECT * FROM xxx";

When the result comes, it brings only the last result of the table instead all.

If I'm not mistaken, most remote databases come with a limit on the amount of data that is fetched, in order to avoid overflowing results. But none of that is for sure, just my speculation. Anyway, how to solve this?

$stmt = mysqli_stmt_init($conn);

$sql = "SELECT * FROM favorite";

mysqli_stmt_prepare($stmt, $sql);

mysqli_stmt_execute($stmt);

$result = mysqli_stmt_get_result($stmt);

$row = mysqli_fetch_assoc($result);

var_dump($row);
Dharman
  • 26,923
  • 21
  • 73
  • 125
sigleane
  • 53
  • 4
  • You should add all query codes in to question we cant help with that infos. –  Oct 22 '21 at 00:54

1 Answers1

0

Try

$row = mysqli_fetch_all($result);
mysqli_fetch_assoc();

only returns 1 row which explains why you only see the last row of the expected result set.

mysqli_fetch_all

Rob Moll
  • 3,316
  • 2
  • 8
  • 15