Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display more than one Result from DB

Status
Not open for further replies.

Sitehelp

Technical User
Feb 4, 2004
142
GB
Hi! Any ideas why this:

mysql_select_db($database_MARTIN, $MARTIN);
$query_CallsAssignedCount = "SELECT StaffID, count(CallID) FROM callinfo WHERE callinfo.StaffID = '$row_Leader1[StaffID]' GROUP BY StaffID ORDER BY CallID ASC";
$CallsAssignedCount = mysql_query($query_CallsAssignedCount, $MARTIN) or die(mysql_error());
$row_CallsAssignedCount = mysql_fetch_assoc($CallsAssignedCount);
$totalRows_CallsAssignedCount = mysql_num_rows($CallsAssignedCount);

only displays one result and not all StaffIDs? Its meant to list all StaffIDs and the number of calls closed by that staff member. '$row_Leader1[StaffID]' is the coloumn that lists all the client IDs on another form. This lists all StaffIDs fine, however, this SQL command (above)only displays ONE StaffIDs result. Cheers!
 
Don't cross-post. It's annoying and rude.

Anyway, the problem is not with MySQL, but rather with your PHP code.

I have answered your question in thread434-790638

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
The SQL query does not make any sense. It should result in a semantic error as you can not get a predictable result.

Assume that you have the following data

staffid callid
--------------
______1 ______1
______1 ______2
______2 ______2
______2 ______1


Which value for callid should be used when ordering?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top