$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?
SQL COUNT
Moderator: General Moderators
-
prasadharischandra
- Forum Commoner
- Posts: 57
- Joined: Thu May 09, 2002 2:19 am
- Location: sri lanka
- Contact:
- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact:
if you're trying to find the number of rows try:
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
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;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
Your query will always return one row. It's the data returned that's interesting. Keep your original query and then do like this:
This should be the most effective approach.
/josa
Code: Select all
$data = mysql_fetch_assoc($find_wait);
echo $dataї'test'];/josa