How can i check if the where clause returns a record?
I have try with <?php echo count($rows); ?> in the body and header section under the "Connection View Settings" but nothings is display.
I know that the where clause return at least one record since if a try using a field name, the data exist.
I have no (empty) where clause in the "WHERE SQL" section.
				
				
				
			I have try with <?php echo count($rows); ?> in the body and header section under the "Connection View Settings" but nothings is display.
I know that the where clause return at least one record since if a try using a field name, the data exist.
I have no (empty) where clause in the "WHERE SQL" section.
					Hi carestra,
Put {column_name} in the section - with any valid column name from the table - there's a list you can check on the Admin Settings tab.
Bob
				
				
				
			Put {column_name} in the section - with any valid column name from the table - there's a list you can check on the Admin Settings tab.
Bob
					Hi Mr GreyHead,
Thanks for your advise, it seems that I did not explain may problem correctly.
This is my table:
Table name: YOYO
Column name : id - persname - age
record 1 : 3 - Kali - 12
record 2 : 5 - Yada - 65
record 3 : 45 - Mambo - 43
That I want to do is to display the number of records in the table YOYO.
I have try with <?php echo count($rows); ?> but the response is always 0 (zero) no matter the number of records in the table. How to I retreive the number of records that the WHERE SQL clause returns?
Thanks in advance
Carestra
				
				
				
			Thanks for your advise, it seems that I did not explain may problem correctly.
This is my table:
Table name: YOYO
Column name : id - persname - age
record 1 : 3 - Kali - 12
record 2 : 5 - Yada - 65
record 3 : 45 - Mambo - 43
That I want to do is to display the number of records in the table YOYO.
There are 3 persons:
name: Kali
name: Mambo
name: YadaI have try with <?php echo count($rows); ?> but the response is always 0 (zero) no matter the number of records in the table. How to I retreive the number of records that the WHERE SQL clause returns?
Thanks in advance
Carestra
					Hi carestra,
Try this in the Header (or Footer) box.
Bob
				
				
				
			Try this in the Header (or Footer) box.
<?php
$db =& JFactory::getDBO();
$query = "
    SELECT COUNT(*)
        FROM `YOYO` ;
";
$db->setQuery($query);
$count = $db->loadResult();
echo "<div>There are $count records in the table";
?>Bob
					Thanks, it works.
I don't understand the purpose of the "Query Related Settings" section.
I assume that the "where"-part just state
It should return a result set just as the code snip "$db->setQuery($query);", why can't I just use that result set?
				
				
				
			I don't understand the purpose of the "Query Related Settings" section.
I assume that the "where"-part just state
select * from YOYO WHERE XXX=='YYY'It should return a result set just as the code snip "$db->setQuery($query);", why can't I just use that result set?
This topic is locked and no more replies can be posted.
		
	
  