This is probably more php than chrono but thanks to some previous posts and great answers I have a search form (collecting 'searchword') and a query that returns relevant entries.
But the display (the 'foreach' part) prints only one record.
Do I need to create a new array/key or should this be working as is?
There is so much help on how to get stuff INTO databases but so much less on how to get it OUT.
And that's the whole point - I'm sure everyone already knows except me!
But the display (the 'foreach' part) prints only one record.
Do I need to create a new array/key or should this be working as is?
There is so much help on how to get stuff INTO databases but so much less on how to get it OUT.
And that's the whole point - I'm sure everyone already knows except me!
<?php
$db =& JFactory::getDBO();
$searchword = JRequest::getString('searchword', '', 'post');
if ( $searchword ) {
$query="
SELECT *
FROM `#__chronoforms_venues`
WHERE `venue_name` LIKE '%$searchword%'
OR `town` LIKE '%$searchword%'
ORDER BY `venue_name` ASC";
$db->setQuery($query);
//echo '<div>$query: '.print_r($query, true).'</div>';
$rows = $db->loadRowList();
//echo '<div>$rows: '.print_r($rows, true).'</div>';
//so far so good, I think.
foreach ($rows as $result ); {
echo "<div>".$result [5].", ".$result [6].", ".$result [8]."</div>";
}
}
?>