Jump to content

Row Count


SkyRanger

Recommended Posts

I am trying to count rows where there is multiple entries.

 

userlevels: (column name)

2

3

4

 

I can get them to post separate

 

What I need to do is do a row count with 2 of the number 3 and 4

 

example:

 

userlevels:

 

2 - 1 Entry

3 - 2 entries

4 - 3 entries

 

if ($resultt = $mysqli->query("SELECT userlevel FROM users where userlevel='3' and userlevel='4' ")) {

   /* determine number of rows result set */
   $row_cntt = $resultt->num_rows;

   printf("%d", $row_cntt);

   /* close result set */
   $resultt->close();
}

 

I got it so:

 

Level 2 : 1 User

Other: 0 Users but as stated there are 2 for 3 and 3 for 4

Link to comment
https://forums.phpfreaks.com/topic/274067-row-count/
Share on other sites

Thank Jessica,

 

ok Tried this and still an output of 0

 

if ($resultt = $mysqli->query("SELECT userlevel, count(*) FROM users where userlevel='3' and userlevel='4' group by userlevel")) {

/* determine number of rows result set */
$row_cntt = $resultt->num_rows;

printf("%d", $row_cntt);

/* close result set */
$resultt->close();
}

Link to comment
https://forums.phpfreaks.com/topic/274067-row-count/#findComment-1410299
Share on other sites

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.