Page 1 of 1

Retrieving the COUNT...

Posted: Tue May 20, 2003 11:34 am
by Sinnix
I've got this MS SQL query

Code: Select all

$ms_result = (mssql_query("SELECT count(cellname) FROM cell_table WHERE ((state=27)OR((state=28)AND(pstate_id=0))) AND (current_operator='$uname')"));
... and this code...

Code: Select all

$cell_edit = (mssql_fetch_row($ms_result));
... and a return of "array". I normally understand how to retieve information from a mssql query... but this is a little different because I'm doing a COUNT. Any suggestions??

Posted: Tue May 20, 2003 11:46 am
by JPlush76
you're going to want to use whats called an alias in your mysql query so count(field) will be count(field) as newname

what that does is say take the value of counting that field and make it a new variable called newname

now when you pull it out of the array the name will be "newname" just like any other variable. Hope that helps

Posted: Tue May 20, 2003 12:52 pm
by Sinnix
Helps?? Are you kidding! ;) You just solved my problem! You freakin' rule. Thanks doOd. :D 8)