Home > Enterprise >  select * in a remote DB (mysql) doesn't bring all the data
select * in a remote DB (mysql) doesn't bring all the data

Time:10-23

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?

(im using phpadmin to get acess to the DB)

EDIT: this is my code

 $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);

CodePudding user response:

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

  • Related