The sql_fetsel function returns the first row of results for a selection. It accepts the same parameters as the sql_select() function and is a short-cut for the combined call of sql_select() and sql_fetch().

Its parameters are:

  1. $select,
  2. $from,
  3. $where,
  4. $groupby,
  5. $orderby,
  6. $limit,
  7. $having,
  8. $serveur,
  9. $option.

It is used as shown below:

$r = sql_fetsel('colonne', 'table');
// $r['colonne']


Select the "id_trad" and "id_rubrique" columns of a given article:

$row = sql_fetsel("id_trad, id_rubrique", "spip_articles", "id_article=$id_article");
// $row['id_trad'] and $row['id_rubrique'] 

Select all the columns for a given news item:

$row = sql_fetsel("*", "spip_breves", "id_breve=$id_breve");

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

Translations : English, français