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:

  1. $res = sql_select('column', 'table');
  2. $all = sql_fetch_all($res);
  3. // $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:

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


Author Mark Baber Published : Updated : 02/06/10

Translations : English, français