Jump to content

[SOLVED] Read and display data in numerical form


dazz_club

Recommended Posts

Hi guys,

 

I've got a database full of members, and what i would like to do for my admin page is to have a paragraph that informs me with updated info.

 

What i want to know, or if someone can direct me to a good tut, is have a script that reads the amount of members i a from my table and simply have it displayed as a number.

 

over all this is what i want to achieve and the number in bold are driving by a script the present the data as a number.

 

---------------------

We have 14 enquiries, 2 new ones from Darren Azzopardi

 

We have recieved 7 feedback comments

 

Only 2 people have had problems loggin in

----------------------

 

kind regards

Darren

Total enquiries:

SELECT COUNT(*) FROM `members`

 

New enquiries:

SELECT COUNT(*) FROM `members` WHERE `new`='yes'

 

Number of comments:

SELECT COUNT(*) FROM `feedback` WHERE `read`='no'

 

Login problems:

SELECT COUNT(*) FROM `members` WHERE `loginproblem`='yes'

 

That's the basics but it depends on how you want to form the tables and how you're handling the data.

Hi ,

 

I have set up a basic query, but i think i missing something as my result only retrieves 1

 

<?php
$sql = "SELECT COUNT(*) FROM contacts";
$result = mysql_query($sql);
echo mysql_num_rows($result);
?>

 

kind regards

Dazzclub

Done some tweaking to the code. Snow the code looks like this.

 

<?php
$sql = mysql_query("SELECT * FROM contacts");
$num_rows = mysql_num_rows($sql);
echo "$num_rows Rows\n";
?>

 

and it works...well need to double check but its good for me

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.