![]() |
|
#1
|
|||
|
|||
countis this code correct? but i got this error message 'Resource id #2'
<? $Connect = mysql_connect("localhost","root",""); mysql_select_db("mw"); $result=mysql_query("select count(StaffID) from LeaveApplication1 where StaffID = 'fui'") ; echo "$result"; mysql_close(); ?> |
|
#2
|
||||
|
||||
Use mysql_result() function for this...$result is just a 'result resource' so it's no surprise that you get that back.
Since you asked for one 'result' expecting just a sum of all the records that matched that criteria, you can try using: PHP Code:
Please look up the function mysql_result() at php.net for some important notes regarding the use of this function. __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
Recent GIDBlog
Toyota - 2008 July Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| count date | skyloon | MySQL / PHP Forum | 2 | 01-Jul-2003 01:28 |
| FAQ - Challenger Forum | JdS | Learning Journal by J de Silva | 0 | 11-May-2002 02:28 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The