Jump to content

[SOLVED] how can i count the number of rows in a DB and echo the amount?


frijole

Recommended Posts

<?php

  $sql = "SELECT COUNT(id) AS cnt FROM emaillist";
  if ($result = mysql_query($sql)) {
    if (mysql_num_rows($result)) {
      $row = mysql_fetch_assoc($result);
      echo "There are {$row['cnt']} users on the email list";
    }
  }

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.