Afser Posted May 11, 2007 Share Posted May 11, 2007 Hello Friends, I want a help from you people.. <? include_once("include/conn.php"); include_once("include/functions.php"); if(isset($_POST['search'])) { $search_query=""; $val = "0"; if($_POST['property_type']!='select')// && $_POST['country']!='select' && !empty($_POST['ind_type'])) { if(!empty($search_query)) $search_query .= " AND property_type='$property_type'"; else $search_query = " property_type='$property_type'";// AND country='$country' AND industry_type like '%$ind_type'"; } if($_POST['region']!='select') { if(!empty($search_query)) $search_query .= " AND region='$region'"; else $search_query = " region='$region'"; } if($_POST['pax']!='select') { if(!empty($search_query)) $search_query .= " AND pax >='".$_POST['pax']."'"; else $search_query = " pax >='".$_POST['pax']."'"; } if($_POST['swimming_pool']!='select') { if(!empty($search_query)) $search_query .= " AND swimming_pool='$swimming_pool'"; else $search_query = " swimming_pool='$swimming_pool'"; } if($_POST['keyword']!='') { if(!empty($search_query)) $search_query .= " AND Beds='$keyword'"; else $search_query = " Beds='$keyword'"; } if($search_query!="") $search_query = " Where ".$search_query; } echo $search_query; $search_result=getSearchList($search_query); // print_r($search_result[0]); foreach ($search_result as $sr) { ?> i am Getting Result out.. here i want to get the Number of Rows in Result set .. how to get it Link to comment https://forums.phpfreaks.com/topic/50931-how-to-retrieves-the-number-of-rows-from-a-result-set-in-php-mysql/ Share on other sites More sharing options...
soycharliente Posted May 11, 2007 Share Posted May 11, 2007 Hope this helps: <?php $query = "SELECT * FROM table"; $result = mysql_query($query) OR DIE (mysql_error()); $numRows = mysql_num_rows($result); ?> Link to comment https://forums.phpfreaks.com/topic/50931-how-to-retrieves-the-number-of-rows-from-a-result-set-in-php-mysql/#findComment-250509 Share on other sites More sharing options...
Afser Posted May 11, 2007 Author Share Posted May 11, 2007 I GETTING A ERROR You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Where region='chianti'' at line 1 Link to comment https://forums.phpfreaks.com/topic/50931-how-to-retrieves-the-number-of-rows-from-a-result-set-in-php-mysql/#findComment-250523 Share on other sites More sharing options...
soycharliente Posted May 11, 2007 Share Posted May 11, 2007 Trying posting the code that gives the error. We can't possibly know what is wrong unless we see the code. Link to comment https://forums.phpfreaks.com/topic/50931-how-to-retrieves-the-number-of-rows-from-a-result-set-in-php-mysql/#findComment-250539 Share on other sites More sharing options...
per1os Posted May 11, 2007 Share Posted May 11, 2007 You do not have a full query. There is no SELECT col1, col2 FROM table_name WHERE. You simply have a where clause. Link to comment https://forums.phpfreaks.com/topic/50931-how-to-retrieves-the-number-of-rows-from-a-result-set-in-php-mysql/#findComment-250613 Share on other sites More sharing options...
Afser Posted May 15, 2007 Author Share Posted May 15, 2007 Thank You guys.. Link to comment https://forums.phpfreaks.com/topic/50931-how-to-retrieves-the-number-of-rows-from-a-result-set-in-php-mysql/#findComment-253390 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.