PC & IT SUPPORT MADE EASY FORUM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

a function to count rows in a table

Go down

a function to count rows in a table Empty a function to count rows in a table

Post by jamied_uk 19th September 2013, 13:53

Code:
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
jamied_uk
jamied_uk
Admin

Posts : 2951
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Back to top

- Similar topics

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