a function to count rows in a table

View previous topic View next topic Go down

a function to count rows in a table

Post by jamied_uk on 19th September 2013, 13:53

function CountRows($table){
$table = "chats";
$query = "SELECT COUNT(id) FROM `".$table."`
    $count = mysql_fetch_array(mysql_query($query));
    return $count[0];

$newcount = CountRows(chats);
the last line of code is used to set this result into a varible


Posts : 1981
Join date : 2010-05-09
Age : 34
Location : UK


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum