PDA

View Full Version : need some help with counting ...


HormonX
11-11-2002, 05:52 PM
Here is the problem .. or more like a question.

I have a very simple search form and i want to count how many results are found .. and if nothing is found i want to display a message.

Code for searching and displaying works fine .. it's counting that's got me in a bit of problem.

Anyone can help ?

Thanx

HormonX

Nightfire
11-11-2002, 06:04 PM
Are you using Mysql? or text files?

HormonX
11-11-2002, 06:06 PM
am using mysql

Nightfire
11-11-2002, 06:49 PM
$sql = "select * from tablename where field='$query'";
$result = mysql_query($sql);
if($row = mysql_num_rows($result)){
echo 'Number of results found '.$row.'.';
}else{
echo 'No results';
}

Only off the top of my head. Not tested it but it should work

HormonX
11-11-2002, 07:08 PM
yeap it works ...

thanx nightfire :thumbsup: