Hi,
I am trying to display a number of pirticular units in a database. I have the following which shows the total number of units, but not the pirticular units.
For example, the code below will show: There are 11 Widgets.
What I am trying to show is:
There are 4 Red Widgets.
There are 2 Blue Widgets.
There are 5 Green Widgets.
Does anyone know how to do this please?
There are <?php
$result = mysql_query("SELECT * FROM organiserdbase", $link);
$num_rows = mysql_num_rows($result);
echo "$num_rows \
";
?> Widgets
Cups
August 25, 2012, 9:08pm
2
Can you show us the relevant contents of one or two rows from your table?
Row: category
event manager
party planner
I am trying to read ‘category’ to show their are 16 Event Managers and 3 Party Planners.
At the moment I can only 19.
Cups
August 26, 2012, 12:03am
4
What does this show you?
$sql = "SELECT count(category) from organiserdbase
WHERE category = 'event manager'";
Hi,
This also picks out the total number of values. It shows 11 Red Widgets instead of 4 Red Widgets.
Hi,
Does anyone have any suggestions please?
Cups
August 27, 2012, 9:06am
7
Just how many tables do you have, and do they contain widgets or people?
I am trying to read ‘category’ to show their are 16 Event Managers and 3 Party Planners.
Then:
This also picks out the total number of values. It shows 11 Red Widgets instead of 4 Red Widgets.
I think its time to show us the contents of 2 or 3 rows of one of these databases.
Thanks,
Whats the easiest way to do that, Im just using Widgets as an example obviously.
$result = mysql_query("SELECT * FROM organiserdbase", $link);
$result = "SELECT count(category) from organiserdbase
WHERE category = 'event manager'";
Should this work?
Cups
August 27, 2012, 2:14pm
9
Did you try it? What happens?
$qry = "SELECT count(category) from organiserdbase WHERE category = 'event manager'";
$result = mysql_query($qry, $link);
$a = mysql_fetch_array($result);
var_dump( $a );
Cups:
Did you try it? What happens?
$qry = "SELECT count(category) from organiserdbase WHERE category = 'event manager'";
$result = mysql_query($qry, $link);
$a = mysql_fetch_array($result);
var_dump( $a );
Hi, I tried this but it prints the code out on the page.
When I echo the result it echoes the following “Resource id #6 ” Not sure what that means.
I tried the below but it also echoed the total overall number of units in the row. It didn’t read how many “event manager” there are.
$sql = "SELECT count(category) from organiserdbase
WHERE category = 'event manager'";
Hi,
Does anyone have any suggestions on what I can do this? There must be a way of doing it.