...

Count(*) .... help please :)

HormonX
08-03-2002, 05:32 PM
Am not sure what am doing wrong ... am trygin to count a number of rows in the db below is the statement;

SELECT COUNT(*) FROM table_name;

i mean this should work .. i think :) and i think in a way it does work, but the result i get is kind confusing ... it's not something i expected .. here it is below, ...


Resource id #7

thanx for all your help

HormonX

firepages
08-04-2002, 03:43 AM
need to see your code, assumin you are doing this (and assuming PHP)

$yaks=mysql_query("SELECT COUNT(fieldname) FROM tablename");

then if you echo $yaks (which is what I am assuming you are doing) you will get the result as per your post which is just a pointer to the actual result data and not the result itself... so you then have to...

$row=mysql_result($yaks,0);//as we are only fetching 1 row mysql_result is ok - else do not use it !//
echo $row;

OR

$row=mysql_fetch_row($yaks);
echo $row[0];

HormonX
08-04-2002, 08:47 PM
thank you ...

it works like magic :) ... i knew i was missing something :)

thanx again :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum