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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.