MySQL Forums
Forum List  »  Newbie

Re: COUNT(*) problem - mysql
Posted by: Patrik Johansson
Date: June 13, 2005 11:04AM

Try this:

$db=mysql_connect('hostname', 'usenamne', 'password');
mysql_select_db('databasename',$db);
$sql="SELECT COUNT(*) FROM love WHERE male = '1' ";
$ret=mysql_query($sql);
$row=mysql_fetch_row($ret);
$malenumber=$row[0];

or this

$db=mysql_connect('hostname', 'usenamne', 'password');
mysql_select_db('databasename',$db);
$sql="SELECT * FROM love WHERE male = '1' ";
$ret=mysql_query($sql);
$malenumber=mysql_numrows($ret);

Options: ReplyQuote


Subject
Written By
Posted
June 13, 2005 10:04AM
Re: COUNT(*) problem - mysql
June 13, 2005 11:04AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.