Categories > TinyButStrong general >

count(*) in sql

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Thomas
Date: 2003-07-31
Time: 14:27

count(*) in sql

How to get number of records into variable $A using sql like this
'select count(*) from table' without using html template.
By: Skrol29
Date: 2003-07-31
Time: 14:50

Re: count(*) in sql

Is that a question pure MySQL/PHP ?

The following function returns the first value for a SQL statement :
function m_Sql_Eval($Sql,$Default=False) {
  $Rs = mysql_query($Sql) ;
  $Val = mysql_fetch_array($Rs) ;
  if (is_resource($Rs)) mysql_free_result($Rs) ;
  if ($Val===False) {
    return $Default ;
  } else {
    return reset($Val) ;
  }
}