Jump to content

Counting records by a unique field


jesushax

Recommended Posts

hi below is my code

 

<?php
$notes = mysql_query("SELECT COUNT(*) FROM tblCompanyNotes WHERE UserID='".$ID."' ") or die (mysql_error());
$files = mysql_query("SELECT COUNT(*) FROM tblCompanyFiles WHERE UserID='".$ID."' ") or die (mysql_error());

$CNotes = mysql_fetch_array($notes);
$CFiles = mysql_fetch_array($files);

echo 'You have a total of '.$CNotes.' notes<br />';
echo 'You have a total of '.$CFiles.' files available for download<br />';
?>

 

and it outputs this

 

You have a total of Array notes

You have a total of Array files available for download

 

whats wrong here, can anyone tell me?

 

Cheers

 

 

Link to comment
https://forums.phpfreaks.com/topic/95427-counting-records-by-a-unique-field/
Share on other sites

now i have

<?php
$notes = mysql_query("SELECT COUNT(*) as total FROM tblCompanyNotes WHERE UserID='".$ID."' ") or die (mysql_error());
$files = mysql_query("SELECT COUNT(*) FROM tblCompanyFiles WHERE UserID='".$ID."' ") or die (mysql_error());

$CNotes['total'];

$CFiles = mysql_fetch_array($files);
$CNotes = mysql_fetch_array($notes);
echo 'You have a total of '.$CNotes.' notes<br />';
echo 'You have a total of '.$CFiles.' files available for download<br />';

echo $notes;
?>

 

and still, same result :(

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.