The sql_fetch_all() function returns an array containing all of the rows for a selection resource. Since all of the results will be stored in current memory, you should be careful not to select too much content at once.

The sql_fetch_all() function accepts 3 parameters:

  1. $res is the resource obtained using an sql_select(),
  2. $serveur,
  3. $option.

It is used as in the example below:

$res = sql_select('column', 'table');
$all = sql_fetch_all($res);
// $all[0]['column'] is the first row

However, this function is not often used, since the sql_allfetsel() function can execute much the same operation but also with selection parameters:

$all = sql_allfetsel('column', 'table');
// $all[0]['column'] is the first row

Author Mark Baber Published : Updated : 12/03/23

Translations : English, français