Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8616239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:34:14+00:00 2026-06-12T05:34:14+00:00

I am trying to display statistics of my database table. I have a column

  • 0

I am trying to display statistics of my database table. I have a column called topics and it contains different values and then a column called priority which contains fields with values between 1-10.

Now, what I would like to do is display statistics for this table in the following format.

xx of the priority “1” have the topic “xxxxxx” as topic.
xx of the priority “1” have the topic “yyyyyy” as topic.
xx of the priority “1” have the topic “zzzzzz” as topic.
xx of the priority “2” have the topic “xxxxxx” as topic.
xx of the priority “2” have the topic “yyyyyy” as topic.
xx of the priority “2” have the topic “zzzzzz” as topic.

And so on.

I have the following code but it is returning a ”
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given” error when I try to use it.

<?php
    $hostname = "localhost";
    $username = "root";
    $password = "";
    $database = "dbname";

    $connection = mysql_connect($hostname, $username, $password) OR die('Could not connect to MySQL: ' . mysql_error());
    mysql_select_db($database);

$sql = "
       SELECT priority, COUNT(priority) as nbr_of_priorities, topic, 
       FROM table_Name
       GROUP BY priority, topic
    ";

$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
         echo $row['nbr_of_priorities'].'of the priority'.$row['priority'];
         echo 'has'.$row['topic'].'as topic';
}
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:34:16+00:00Added an answer on June 12, 2026 at 5:34 am

    Have you run your query against the DB?

    I see an erroneous comma in your SQL, after “topic”… your query could be failing, then $results would be false (which you are not testing), then your while would fail with that error…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying display values in a datagrid in my application. I have all
Im trying to display 3 forms(calender, history, statistics) which has 3 classes into a
trying to display data only after variables have been set. $(document).ready(function () { function
I am trying to display all possible values for a sub-property. Below I am
I have an array of Person pocos, populated below. I'm trying display them alphabetically
Trying to display a message for each text box which the user didn't enter
Trying to display related data from a hasMany through table. It's finding the joinModel
im trying to display date and time from MSSQL Server datetime table using PHP,
While trying to display a GUID column in a report ..its displayed as #error
I'm trying to analyse a query execution plan in my Oracle database. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.