Page 1 of 1

SQL COUNT

Posted: Mon Jul 01, 2002 1:17 am
by prasadharischandra
$find_wait=mysql_query("select count(pas_dep_seat) as test from pase_res where pas_dep_flight='$fl_no' or pas_rtn_flight='$fl_no'") or die(mysql_error());

$find_test=mysql_num_rows($find_wait);
echo $find_test;
how i get counting out put?

Posted: Mon Jul 01, 2002 2:32 am
by hob_goblin
if you're trying to find the number of rows try:

Code: Select all

$find_wait=mysql_query("select * from pase_res where pas_dep_flight='$fl_no' or pas_rtn_flight='$fl_no'") or die(mysql_error()); 

$find_test=mysql_num_rows($find_wait); 
echo $find_test;
that will print the number of rows that have $fl_no as pas_dep_flight and $fl_no as pas_rtn_flight

if this isn't what you want to find... then could you be a little more specific as in what you are trying to find

Posted: Mon Jul 01, 2002 3:54 pm
by josa
Your query will always return one row. It's the data returned that's interesting. Keep your original query and then do like this:

Code: Select all

$data = mysql_fetch_assoc($find_wait);
echo $dataї'test'];
This should be the most effective approach.

/josa